Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

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

Asked by
doomiiii 112
8 years ago

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

Log in to vote
0
Answered by 8 years ago
Edited 8 years ago

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.

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 doomiiii 112 — 8y
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) alelollo 52 — 8y
0
Thanks, @alelollo! Looks like quite a bad hack, but it does not surprise me at all! Hah! Gonna try it out soon :) doomiiii 112 — 8y
0
@alelollo you should've posted this as an answer in case others somehow asks the same question. User#5748 20 — 8y
Ad

Answer this question