Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Purely kinematic objects - How to disable physics completely for specific parts?

I want some objects to not interact with the world in any physical sense, but at the same time, I want to be able to use scripts to control them. This is a very common feature in game engines, necessary for all sorts of kinematic effects, such as (in my case): floating pick-ups, which have a custom floating animation, but don't interact with the world unless being touched by the player.

Trying to disable CanCollide while anchoring should in theory do the trick, but for some reason this creates terrible physics glitches when trying to interact with the object. This is also mentioned in this Tools tutorial:

Make sure all of the parts are not anchored when you are finished building. If any part of the Tool is anchored, the Tool won’t be able to move and the character will get stuck when picking it up.

Is there any chance to achieve purely kinematic objects that do not physically interact with the world (except some special circumstances such as players touching)? Ideally I would like this to work with normal Parts, as I want to create custom pick-ups from existing world objects, such as this miniaturized soldier:

Screenshot

Any help is appreciated! :)

1 answer

Set Anchored to true.

part.Anchored = true

Though there isn't really a way to fix the glitching your talking about. I'd recommend waiting for collision filters? Tho I'm also doing what your doing currently. And I don't actually have any glitching problems. I'm using a part to animate.. of course CanCollide is set to true. I'm also waiting for collision filters.

Not that it will help but make sure the part is anchored when your controlling it with your script.

4 comments

0

I am now using a solution similar to the one described to what the wiki says on "Floating Sphere", but sadly the CanCollide property of Head and Torso always get set back to true automatically. I cannot deactivate it. - http://wiki.roblox.com/index.php?title=Making_a_Floating_sphere

0

To make the cancollide property of your head and torso always false you need to use this: game:GetService("RunService").stepped:connect(function() game.Players.LocalPlayer.Character.Torso.CanCollide=false game.Players.LocalPlayer.Character.Head.CanCollide=false end)

0

Thanks, @alelollo! Looks like quite a bad hack, but it does not surprise me at all! Hah! Gonna try it out soon :)

0

@alelollo you should've posted this as an answer in case others somehow asks the same question.

This discussion is preserved as it was. New answers, comments, and votes are closed.