Is it possible to make a part look to where it's falling?


I made this very poorly but i think you got it

you can use cframe.lookat im pretty sure

yeah but idk how to do the math for it

you don’t have the position to look at?

i do but i mean’t that idk how to do the math for the rotating effect

im pretty sure you don’t need math for cframe.lookat

check this video out

1 Like

maybe i can create a part that isn’t going to rotate infront of the projectile and then use cframe.lookat() in the projectile with the part position

try using an AlignOrientation with the following settings, and parent it to the part:

Mode: OneAttachment
PrimaryAxisOnly: True
RigidityEnabled: True

then inside the part add an attachment with the orientation property set to (0, -90, 0). This is so it’s X axis points towards the part’s LookVector

then set the AlignOrientation’s Attachment0 to that attachment.

then put a script in the part that says

local part = script.Parent
local align = part.AlignOrientation

part:GetPropertyChangedSignal('AssemblyLinearVelocity'):Connect(function()
    align.PrimaryAxis = part.AssemblyLinearVelocity
end)

the benefit of this over cframes is that setting the cframe will affect the motion of the part, while align orientation constraitn should just rotate the part and let it fall normally

i havent tested this so lemme know how it works lol

well, nothing happens when it tested it

ok well the problem was :PropertyChangedSignal doesnt work for velocity, but anyway i tested it and this does not work well at all lol

maybe i can do this

this seems to work better, just this script alone in the part:

local RunService = game:GetService('RunService')

local part = script.Parent

RunService.Heartbeat:Connect(function()
	if part.AssemblyLinearVelocity.Magnitude > 5 then
		part:PivotTo(CFrame.lookAt(part.Position, part.Position + part.AssemblyLinearVelocity, part.CFrame.UpVector))
	end
end)

it has problems when it lands it glitches out so you have to check to make sure the velocity is above a certain value so it doesnt glitch when its resting

you can try that too, maybe it would work

i’ll try later on, i gtg

Just use .Changed it works.

script.Parent.Changed:Connect(function(Value)
	print(Value) -- Will print AssemblyLinearVelocity if it changed.
end)

image

You would want to do CFrame.lookAt() and Raycasting in order to achieve what you are looking for if you don’t know the basics of these things then here’s some tutorials that could help.

Raycasting | Roblox Creator Documentation
CFrame | Roblox Creator Documentation