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

Methods of making a stable part that has a body velocity?

Asked by 7 years ago

I have two problems with a part that has a body velocity.

The first problem is the part won't keep straight. If it hits another part in workspace, obviously it will rotate which I'm trying to prevent.

This is a clip of what I mean by it won't keep straight.

Clip

I tried putting a script in the part that makes the part have the same Orientation over and over, but it was VERY buggy and didn't work. This is the script I tried.

while wait() do
    script.Parent.Orientation = Vector3.new(0,0,0)
end

The second problem I'm having which I'm not sure can be prevented, is with R15 and the part. The problem is the part seems very slippery, which only occurs with R15.

Clip

0
Any help would be appreciated! Draebrewop 114 — 7y

2 answers

Log in to vote
1
Answered by 7 years ago

I saw you were already on to one of the solutions I have.

If you use a BodyAngularVelocity, you can keep the part from rotating.

This script will prevent the parent of the BodyAngularVelocity from moving.

local BAV = Instance.new("BodyAngularVelocity",PartCharge)
BAV.AngularVelocity = Vector3.new(0,0,0)
BAV.MaxTorque = Vector3.new(math.huge,math.huge,math.huge)
BAV.P = 1250

As for preventing slipping, the only thing I can think of if custom physical properties didn't work, would be to increase the size of the part.

0
Awesome stuff! Very simple snippet. Could you comment on the reasoning behind 1250? User#18718 0 — 7y
0
Wiki, my friend. :P Ultimate_Piccolo 201 — 7y
Ad
Log in to vote
0
Answered by 7 years ago
Edited 7 years ago

Okay this is out of my area of expertise. My best suggestion in this situation would be to take a look at PhysicalProperties. If your moving objects have more mass they will harder to move by the player (increase density). If you are having problems slipping on the block, change the friction of that block (how well it slides against other things).

local part -- Your part.
local oldProperties = part.CustomPhysicalProperties or PhysicalProperties.new(Enum.Material.Plastic)

local density = 5 -- You can adjust these.
local friction = 1
local elasticity = oldProperties.Elasticity

local props = PhysicalProperties.new(density, friction, elasticity)

part.CustomPhysicalProperties = props

EDIT: Here are some links to the resources I used for this answer. http://wiki.roblox.com/index.php?title=API:PhysicalProperties http://wiki.roblox.com/index.php?title=API:Enum/Material

There is definitely a cleaner answer to preventing the block from moving too much. Remember if this answer helps you to accept it or upvote it.

EDIT 2: Cannot edit properties. Only in initializer.

0
I got an error, PhysicalProperties.Density cannot be assigned to Ultimate_Piccolo 201 — 7y
0
I got the same error as Ultimate_Piccolo Draebrewop 114 — 7y
0
I updated my answer. I apologize. You cannot edit properties like my original script said. You need to use an initializer. I do that in the new edit. Could you test that out? User#18718 0 — 7y
0
Still slippery/rolling. I edited the properties which just made it worse. I think it may have to do with body velocities :/ Draebrewop 114 — 7y
View all comments (3 more)
1
Although I think I MAY have found a solution to one of my problems if BodyAngularVelocity does what I think it does Draebrewop 114 — 7y
0
Hmm. Try local props = PhysicalProperties.new(density, friction, 0, 100, 100) This sets the weights of friction and elasticity super high. Elasticity is set to zero. This is my best guess. User#18718 0 — 7y
0
Thanks for your help kools, but I found my solution! Draebrewop 114 — 7y

Answer this question