How would I make reflections for flight?

Hi, I’m trying to make a type of flight that’s similar to this:

But I’ve hit a roadblock, and that is that I don’t know how to make the reflections work well. What I was planning to do was make it so that a ray is being shot out of the HumanoidRootPart’s LookVector every 10th of a second, but then I realized that the HumanoidRootPart can’t really be rotated upwards (I tried), so if you had to bounce off the ceiling it wouldn’t work because the ray is only going forward.

A solution I haven’t tried is shooting it out of the UpperTorso, but before I do that I want to make sure that this is the most efficient way of doing it. Is there something else I should be doing, or should I continue with this? If there is something I should change, what should it be?

Edit: I’m moving the HumanoidRootPart with a BodyVelocity

2 Likes

How are you moving the character?

Are you setting CFrames every frame?

Are you using FastCast?

Are you just using a BodyForce?

Sorry I forgot to mention that. I’m using a BodyVelocity and setting the Velocity to the HumanoidRootPart’s LookVector

Even though I’m using a Body Velocity, I’m open to other methods

Bumping to see if anyone else has an input

Yea I read that, but I couldn’t figure out how to apply it to flight.

here it is, tell me if it works:

--Put this in BodyVelocity

local bvPower = 100 --Number by what you multiply first flight velocity. Like - CFrame.LookVector*100 etc.

while true do
	local char = script.Parent.Parent.Parent
	
	local params = RaycastParams.new()
	params.FilterType = Enum.RaycastFilterType.Blacklist
	params.FilterDescendantsInstances = char
	
	local normal = script.Parent.Velocity.Unit*10
	
	local raycast = workspace:Raycast(char.HumanoidRootPart.Position, normal, params)
	
	if raycast then
		local reflectedNormal = normal - (2 * normal:Dot(raycast.Normal) * raycast.Normal)
		
		script.Parent.Velocity = reflectedNormal.Unit*bvPower
	end
	
	task.wait(0.5)
end

Not really, but I get what you were going for. I’ll play with it for a bit to see if I get anywhere. Thanks

Bumping once again to see if anybody has any input.

Here are some instructions based on the video:

When the character starts a flight:

  • Send a remote event to the server to start the effects (edit: make the character invis on the server, not the client)
  • Make the character invisible and anchor its root part (edit: just anchor the rootpart for this step)
  • Raycast continuously in the direction of the mouse at the start of the flight and move the invisible character if it doesn’t hit anything
  • If the raycast does hit something, get the Normal of the hit and reflect the direction
  • Continue this until the flight should end (ex: player releases button). Send another remote to the server to stop the effects.
1 Like

Thanks, I’ll try that out shortly

1 Like