Move relative to camera

haha ya that worked for some reason

but there’s unfortunately one final issue

the physics have not been resolved; the scooter just slides up walls. ill attach a video

1 Like

When you rotate an attachment it rotates all the thing attached to it (if you have a part with attachment it rotates part) because that is its property, so I recommend using a part which is independent or put everything inside of player character.

Because alignorientation works with parts aswell or with attachment but that is the problem

I actually had someone help me with it a while ago by showing me how to reflect the velocity during a collision, but this is not always ideal: Linear Velocity Constraint Causes Undesired Behavior During Collisions - #28 by ShaShxa

Here is the video of this issue.

Probably because the linear velocity can use infinite force and i can see that the scooter is tilted a bit

You suggested using the AlignPosition, but I think that might overcomplicate in this case because I will have to do constant raycasts to figure out how the position should change every frame. Do you have any suggestions on what kind of constraint I can use in my case? It seems like LinearVelocity may not be the best choice.

For me it seems that everything is working fine, could you please check in the linear velocity or whatever you use the force that it can use because for some reason I have a strong feeling that that is the problem

You can find it in properties

I am going to sleep now so i will respond tomorrow and just in advance if the force that it can use to achieve the velocity is very high then turn it down but not enough so it can still go up hills but not 90 degree walls

1 Like

You were right! Thank you very much for your help. The MaxForce was set to infinity; changing it to something like even 10_000 fixed the issue. Overall, this was the solution (it was spread out over several responses):


Every frame, you can set the target CFrame to this:

...
if movement.projectedMoveVector == movement.projectedMoveVector and movement.projectedMoveVector.Magnitude ~= 0 then
  local lookVectorYComponent = (-movement.projectedMoveVector.X * targetCFrame.UpVector.X - movement.projectedMoveVector.Z * targetCFrame.UpVector.Z) / targetCFrame.UpVector.Y
  local lookVector = Vector3.new(movement.projectedMoveVector.X, lookVectorYComponent, movement.projectedMoveVector.Z)
  local rightVector = -targetCFrame.UpVector:Cross(lookVector)
			
  targetCFrame = CFrame.fromMatrix(
	scooterPhysicsBox.Position,
	rightVector,
	targetCFrame.UpVector,
	-lookVector
  )
end

alignOrientation.CFrame = targetCFrame

This will allow the scooter to turn as expected. When it comes to the collisions, the issue lies with the max force. Change the max force to something lower and it should work as expected.

1 Like

Great, that you answered I am glad to hear that everything works fine.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.