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

What Body Force should I use?

Asked by
RedCombee 585 Moderation Voter
9 years ago

Hello. I am attempting to make an open-close door that swings open and closed like a realistic door. However, I am very inexperienced with body forces, and I am unaware of which one would be best for this project. Any answers or ideas will be appreciated. Thanks.

Happy Thanksgiving!

0
Can't you just use hinges? obcdino 113 — 9y
0
I'm looking to make a scripted animation. RedCombee 585 — 9y

2 answers

Log in to vote
0
Answered by 9 years ago

You do not need to use a BodyForce for this.

http://wiki.roblox.com/index.php?title=Making_a_Door

This could work for opening the door:

local door = script.Parent
local cpos = door.Position -- position when closed
local opos = Vector3.new(0,0,0) -- position of the door when you open it

local bp = Instance.new(¨BodyPosition¨,door)
bp.Position = door.Position
-- make changes to the BodyPosition here

local open = false -- debounce

door.Touched:connect(function(hit)
    local p = game.Players:GetPlayerFromCharacter(hit.Parent) -- checks if it is a player
    if p then
        if open == false then
            open == true
            bp.Position = opos
            repeat wait() until door.Position == opos
            wait(3)
            bp.Position = cpos
            repeat wait() until door.Position == cpos
            open = false
        end
    end
end)
0
The door opening-closing is supposed to be a scripted animation. I'm sorry that wasn't clear. Thanks, though! RedCombee 585 — 9y
Ad
Log in to vote
0
Answered by 9 years ago

You should probably most likely use BAV or bodyangularvolocity you could probably make a great animation with it.

Answer this question