detecting the coordinates where a bullet hits a mesh

V_shr
  • detecting the coordinates where a bullet hits a mesh V_shr

    I have a lot of complex objects in a scene and im looking for an efficient way to find which object a fired bullet hits and to find the hit coordinates. It would be best if there was a lightweight library to do this. it seems that PhysX can do this, but i didnt find a way except to give every face in every mesh a physX system and that seems to become a bottleneck.

    thanks in advance.

Tags
opengl c++
Related questions and answers
  • for all the objects (nextpos = pos + vel) void rotate_obj(); //rotations are the same for every objects too virtual Polygon generate_mesh() = 0; // the polygons are different } and I have 4 different objects in my game: plane, obstacle, player, bullet and I designed them like this: class Player : public GlObject{ private: std::string name; public: Player(); Bullet fire() const; //this method is unique to the class player void generate_mesh(); } Now in the game engine I want to have a general object list where I can check for example for collision, move objects, and so

  • with different types of objects in the same scene. I was also thinking about making a MeshNode class and then make a Mesh object that contains them, but then I have some conflict on where to store some data... shader in every node. Other option I was thinking was making some helper functions to deal with the simpler cases, which would set some default parameters and would ask only the most basic ones... don't want to find out in the end that I have to rewrite everything again, as a lot of other objects will be working with these data. Sorry if it's a too subjective matter, but I need some insight. I'm

  • This question directly follows on from this one: How can I implement a renderer that can draw many kinds of primitives? I have a small amount of drawing code structured in the following way: A mesh object can be instantiated with different configurations of vertices and indices in order to form any desired shape. A reference to this mesh is then passed to every gameObject class, this class... the case. What EXACTLY is the difference between what I'm doing and hardware instancing and what changes do I need to make to achieve it?

  • Right now im working on my c++ game, and im having alot of trouble using GLM and Bullet Physics to create my world correctly. The main problem is that when i export my physics with Blenderv2.57, and export my models for GLM, the models never line up with the physics correctly... Im wondering if there are any model loaders that would be good to use with Bullet Physics, and I can export...: btDefaultMotionState(btTransform(btQuaternion(0,0,0,0),btVector3(x,y,z))); either do it this way: btTransform trans; trans.setIdentity(); trans.setOrigin(btVector3(x,y,z)); btDefaultMotionState

  • . This way all I have to do is plug in the x and z values to the equation to get the y. However, this would require adding 4 floats to every vertex of the heightmap which is a little ridiculous memory wise. Also, my heightmaps are dynamic (meaning the heights will change at runtime), which would mean changing the plane equations every time a vertex's height changes. Is there a faster way... equations for every triangle every time the player moves on that triangle? Is there a better way to do heightmap physics that maintains this simplicity? (this seems very simple to me as far as physics

  • I am using Bullet Physics v2.78. And Im trying to build this library to be used for ogrebullet. The main problem is that Im getting errors trying to find the Bullet Directory. Im wondering if maybe my environment variables are setup wrong. I am using Windows Vista 32 bit, and here are my Environment variables: BULLET_ROOT: C:\BulletPhys BULLET_INCLUDE_DIR: C:\BulletPhys\src as other information I am trying to build these libraries in cMake. Bullet physics builds perfectly, but ogrebullet cant find the libraries needed to configure(Dynamics, Collision, LinearMath, etc.) So my question

  • , that would be nice) Networking(a way to connect multiple clients to a server/database) and Physics(Ive worked with Bullet Physics, but I cant find a model setup that would fit with said physics...Lately I have been working on a game that i plan to make online. I have used different libraries to make this game as far as i could, but I feel that I should rethink on how Im sertting this game up, so I planned to start over. The libraries that I have used are SFML, OpenGL, and Bullet Physics, along with GLM to load the models. But the problem is that the 3D graphics arent working

  • I have got some problem in my OpenGL game. I am using bullet physics and I want to achive quite simple effect - I want one object (a sphere) to roll and hit another (box) which will fall down. I have got almost everything but still I have got some errors. When the box is hit it is rotating almost how I would like to. Well, almost means that when ball hits it it falls and rotates however...); glScalef(0.5,5.0,0.5); glutSolidCube(1.0f); Can someone tell me what is wrong in it? I have got no idea what else I can do.

  • Situation I've got a large map divided into 16*16 parts (comparable to Minecraft) for x and z. For every part a VBO is generated and stored using GL_STATIC_DRAW. Problem The technique described above works fine and with good performance, however it restricts (due to the nature of GL_STATIC_DRAW) modifications that may happen frequently, especially texture animations (that is incrementing texture coordinates to select another sub rectangle in the texture). Now I'm asking myself how to solve that problem. Switching to GL_DYNAMIC_DRAW seems like an overkill to me, since most of the geometry

Data information