Hi, i’m new to the forums and i have a problem shooting a rigidbody. Full story:
I’m making a test game with a space ship wich is a rigidbody and this ship shoots other rigidbodies as projectiles. Everything is perfect but the projectiles are supposed to be laser beams so i don’t want that they make an angle when i’m shooting and i’m turning the ship at the same time so my question is if there is a way to make a rigidbody react only to a force in one axis (so they keep straight forward) or is there another better way to shoot projectiles than this one.
Here is my code and a pair of pictures so you can understand what i’m trying to say:
Ok, i added that code but it doesn’t solve the problem. The projectiles keep going in angle like the second picture shows.
I guess that if there is no way to make the projectiles go straight while the ship is turning, i’ll have to remove the rigidbody of the projectiles and put a script in their prefab so it move forward ignoring the physics.
If its supposed to be a beam the easiest thing to do would be to use a Raycast to a certain distance and apply a force to whatever it hits; could possibly use a Line Renderer component to make a laser effect.
I understand that there’s no thing as a laser projectile but i wanted to make something like in the Star Wars movies, they don’t shoot a straight beam, they go “pew pew”.
Anyway, i’ll just remove the rigidbody of the projectiles and put the moving script in them instead of the ship.