I think I am making the assumption that the signs of the force (- or +) will be handled by the Trig functions above but I have a feeling that is not the case. In general I think this okay but I feel like I am missing something as right now the forces are still a bit sporadic. Use these to assign the Force vector and apply it to the object.Find the resulting Y force by F * sin(angle).Find the resulting X force by F * cos(angle). ![]() I find the angle of the explosion point from the object by atan2(x1-x2,y1-y2)*180/PI.I subtract the distance from F and assign that back to F - so this effectively becomes the total force that can act on the object based on distance.If the distance is less than the force F (my total explosion force) then I proceed.Determining the distance of the explosion point for each of the objects' x,y coordinates. ![]() The ultimate function I call is applyForce and it takes an x,y vector in Newtons for the force and a point to act on (the other objects in this case). What I am currently trying to do is to simulation an explosion with F force in an x,y coordinate system and figure out how other items in the world are affected by it (they each have x,y as well). I'm using a game engine that has a ton of physics stuff built in.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |