# Unity Projectile / Bullets - How Do I? (SOLVED)

This topic is 3893 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I have a sloppy solution for firing projectiles which you can see here at my other Projectile Thread in the math and physics forum. [Edited by - CharlieR on February 17, 2008 7:38:45 AM]

##### Share on other sites
Quote:
 float slopeX = tan(angleX * radian) * Velocity;

I think this should be cos.

##### Share on other sites
Hey Barius, thanks for the attempt.

Your right sorta, but for some hobunk reason my coordinate system seems to be funnified.

Anyway, i originally used cos, but found that tan was the correct function for my particular implementation.

In any case, I would really rather do this with vector math. I'm just lost as to how to do it. From what I can tell, it is trivial to do with vectors. If anyone can point me in the right direction (pun intended), I'd apreciate it greatly.

##### Share on other sites
I maintain a position and direction (3D) and speed (scalar) for each projectile.

For each frame (or general time interval, I don't know what's appropriate for you), I check for the intersection of each projectile with each object of interest. For each object, I maintain a bounding box or sphere and a mesh of triangles for the actual object.

First I check if the projectile is close enough to hit the object in this time interval (a quick cull) - intersection of a vector with a sphere or box.

If not culled, I check intersections with the object's mesh triangles.

1. 1
2. 2
3. 3
Rutin
17
4. 4
5. 5

• 14
• 9
• 9
• 9
• 10
• ### Forum Statistics

• Total Topics
632912
• Total Posts
3009185
• ### Who's Online (See full list)

There are no registered users currently online

×