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

What Body Force should I use?

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!

2 comments

0

Can't you just use hinges?

0

I'm looking to make a scripted animation.

2 answers

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)

1 comment

0

The door opening-closing is supposed to be a scripted animation. I'm sorry that wasn't clear. Thanks, though!

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

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