How do I stop collision forces between two physics objects?

I’ve created a “grabbing system”. It allows you to grab physics objects and to toss them around and such.
image

Problem is, you can use the object that you’re grabbing to fling yourself around and to just otherwise achieve unrealistic speeds.

To solve the problem, I’ve tried disabling collisions between the object and the player. But now you can see right into the object, which is an even bigger problem since when you let go of the object and collision is restored, the player or the object just magically teleport to a position where they no longer collide.
image

Something that would fix this problem would be to disable collision forces between the two objects. That is to say, when the crate and player collide, no force will be applied to the player from the part of the crate.

Unfortunately, I have no idea how to achieve this via scripts, so any help would be greatly appreciated!

Also I’m using a custom character controller, not the regular Humanoid. It’s just one single part with a BodyVelocity that moves it around.
image

1 Like

I don’t know if you’ve tried working with CollisionGroups, but they could be really useful here I think. I also think you should disable the Massless property of whatever you are trying to hold, that way the box has no mass and you aren’t flinging around everywhere .

1 Like

I used Collision groups to disable collisions between the crate and player, unfortunately that led to another problem which I’ve explained in the post.

As for the Massless property, even when it’s on, the object will still have mass but it won’t contribute it to any other part that its welded to. To actually remove the mass, I set the object’s density to 0 but that caused it to become unstable and to just spaz out around the place, all while still unfortunately flinging me.

Your best bet is to use Collision Groups.
Roblox explains how to do this pretty well, and the article is pretty easy to follow. If you still run into issues, send a reply!

3 Likes

Can you see inside the box when you zoom in, or does this happen as soon as you pick up the box with CollisionGroups activated?

A video of the flinging that you are describing would be helpful.

You said you had issues with scripting ‘collision forces’ in the first post.
In the post 3 above this one you stated you tried using them and they caused issues “which I’ve explained in the post” as well.
This sounds like you haven’t tried Collision Groups as others have stated?

Try scripting the Massless property to True only when the player picks the crate up, otherwise if you walk into it or it hits another object it’ll get bounced pretty easily

I’ve tried disabling collisions between the object and the player. But now you can see right into the object, which is an even bigger problem since when you let go of the object and collision is restored, the player or the object just magically teleport to a position where they no longer collide.

I did indeed use collision groups to disable collisions between the player and the crate, both objects are in seperate groups and cannot collide with each other, but it introduces the problem above.

As for the Massless property, even when it’s on, the object will still have mass but it won’t contribute it to any other part that its welded to. To actually remove the mass, I set the object’s density to 0 but that caused it to become unstable and to just spaz out around the place, all while still unfortunately flinging me.

Massless didn’t do anything as it doesn’t remove an object’s mass, it instead stops the object from contributing its mass to other objects.

heres what I would do, using the same line of thought that i used for my custom player movement code

  1. make the object move with AlignPosition, and set the force to something really big. This way it cant be moved by other objects than the mouse
  2. do the same for the rotation with AlignOrientation, so again the mouse/camera only can rotate the object.

Now the rotation is fully in mouse control, and shouldnt be influenced by player rig or other objects
let me know if this didnt help, ill try to make up a better idea


Now that i think of it, using this probably wont be visually pleasing.
Since tweening wouldnt solve our issue (i think) you could just play with Mathematics using CFrame and an anchored object.
This would achieve both 1) and 2) and let you do derivative movement, like acceleration

1 Like

If you are having an issue with the camera going inside the box, you can make it so when the box is in a held state, the player’s camera gets offset via localscript.

Either use Collision Groups or a Collision Weld, or whatever it is called.