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

How to make bottom of part constantly face point?

I'm trying to make a parachute, and in order for it to be realistic I want the bottom of the chute to constantly face a point no matter the position of the chute itself.

I know that CFrames can be initialized with a lookVector so the CFrame faces a certain position, but the problem is I don't want the front of the parachute to face the point, but rather the bottom of it.

I've tried multiplying the lookVector by a bunch of Vector3s but I wasn't really sure what I was doing and it didn't help at all. I've also tried doing cross products to get a perpendicular vector, but I don't know what to multiply. (point.Position - chute.Position).Unit and what?

EDIT: Ok, people want code. It's not going to help, but here you go:

local runService = game:GetService("RunService")

local parachute = script.Parent
local base = parachute:WaitForChild("Base").Value
local dragBF = base:WaitForChild("Drag")

local resistanceCoefficient = 10
local parachuteDistance = 10

runService.Heartbeat:Connect(function(step)
	
	-- Compute the parachute's drag force
	local drag = -base.Velocity * resistanceCoefficient 
	
	-- Compute position and direction of parachute
	local chutePos = base.Position + base.Velocity.Unit * parachuteDistance
	local chuteLV = ????
	
	parachute.CFrame = CFrame.new(chutePos, chuteLV)
	
	dragBF.Force = drag
end)

I don't know what to do for chuteLV

7 comments

0

post script please. we can't help without it. maybe you're doing something wrong

0

It's less that I'm doing something wrong and more that I have no idea what to do

0

Chute is a meshpart (the parachute) and I want it to constantly face the parachute's payload, which is the point that I'm trying to face

0

ChuteLV has to be perpendicular to the Velocity vector

0

Actually if I were to cross product would the second vector even matter since there's more than 1 solution

0

Or am I doing this completely wrong and I shouldn't even use a look vector?

0

Try using CFrame:inverse()

1 answer

OMGOMGOMG I FOUND A SOLUTION FINALLY

Ok this is dead, but in case anyone else encounters this problem, what you have to do is basically construct a CFrame from scratch, using the Rotation matrix to correctly orient the part.

I was actually pretty close to start with, I just didn't realize that what you cross product-ed the Vector3s with didn't matter.

Basically, if you want the upVector to point AWAY from a spot, you set the upVector of the CFrame to be the (beingAligned.Position - beingAlignedTo.Position).Unit.

Then, you cross product that upVector with basically any other unit vector at all, as long as the two are unique. That would yield another perpendicular vector (the thing I was missing). You can use this one as either the frontVector or the rightVector - it doesn't really matter.

For the final, missing vector just cross the first two.

Use the last CFrame.new constructor ... and VIOLA! Problem solved.

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