Strange Bullet Physics

  1. What do you want to achieve?

I am attempting to get the bullet to go directly from the barrel to the mouse position without offsetting laterally.

  1. What is the issue? Include screenshots / videos if possible!

When the bullet spawns, it immediately offsets horizontally, making the effect really strange.

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

I did look for solutions on the developer hub, to no avail. I tried increasing and decreasing the velocity. For some reason, slower velocity has less of an effect, and higher velocity has a more extreme effect. I would like a fast velocity without the offset.

My script sets the CFrame of the bullet using bullet.CFrame=CFrame.new(tool.barrel.Position,mouse.Hit.p)

The bullet then has a LinearVelocity inside of it to go forward at a set velocity.

The barrel might be offsetting it somehow. Try testing different spawn positions:

test = tool.barrel.CFrame * CFrame.new(-1,0,0) --try messing with the x or z axis to get it to align
bullet.CFrame=CFrame.new(test.p ,mouse.Hit.p)

No luck. It offsets in various directions depending on which direction it is facing.

I tried enabling the LinearVelocity after parenting it to the workspace, which seemed to work slightly, but the issue still persists.

If you look closely, the bolt starts at the correct barrel position, but the physics seems to veer it off to the side before going on the correct course.

Might have something to do with LinearVelocity if that’s the case I would try to recenter the attachment to ensure the expected movement of the part. Otherwise, the attachment will determine the movement and the results may not meet your expectations.

Turns out all I needed to do was buff the MaxForce heavily. Thanks for the help anyways @ninetailfox73

1 Like

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