cassius Posted April 1, 2010 Share Posted April 1, 2010 This is a question I probably should have asked right at the start of my 3d aspirations. I need to get some bullets fired from a gun in my game so am I right in supposing that the z coord is the one thats always in front of the camera? Quote amd quad core 4 ghz / geforce 660 ti 2gb / win 10 Blender,gimp,silo2,ac3d,,audacity,Hexagon / using c++ Link to comment Share on other sites More sharing options...
AndyGFX Posted April 1, 2010 Share Posted April 1, 2010 Strictly speaking - each object when is rotated, translated, ... , has oriented toward Z axis vector. For example TurnEntity(e,Vec3(0,0,1)) - move entity in Z axis direction. Camera works same. Your look direction is Z axis direction, oriented by actual camera/entity rotation. Quote [HW] C2D Q6600, 4GB RAM, NV8800GTX, Vista Ultimate x64 [sW] Blide Plus, BlitzMax, Delphi, C++, 3DWS 5.53, Leadwerks 2.xx Link to comment Share on other sites More sharing options...
cassius Posted April 1, 2010 Author Share Posted April 1, 2010 I see . So if I move a bullet in the z direction it will always go where the gun is pointing ? Also do I actualy need a bullet? Is there some other way? Quote amd quad core 4 ghz / geforce 660 ti 2gb / win 10 Blender,gimp,silo2,ac3d,,audacity,Hexagon / using c++ Link to comment Share on other sites More sharing options...
Joh Posted April 6, 2010 Share Posted April 6, 2010 Not exactly.. You need to find local position of gun before. Check this link http://leadwerks.com/werkspace/index.php?/topic/1620-solved-placing-objects-in-front-of-you/ I know that's lua but the code is really similar. Quote Intel Corei7-6700, NVIDIA GeForce GTX 980, 32GB DDR4, W-10. Link to comment Share on other sites More sharing options...
cassius Posted April 6, 2010 Author Share Posted April 6, 2010 Thanks for replies. I am surprised there hasn't been more interest in this subject considering the number of people who use a gun in their game. I would like to see some code either in c or Bmax. A demo of a firing gun. Quote amd quad core 4 ghz / geforce 660 ti 2gb / win 10 Blender,gimp,silo2,ac3d,,audacity,Hexagon / using c++ Link to comment Share on other sites More sharing options...
Joh Posted April 6, 2010 Share Posted April 6, 2010 Well isn't harder then this: //This is where we set the position TVec3 V = TFormVector( Vec3(0,0,1), gun, null ); V= Vec3(EntityPosition(gun).x +V.x,EntityPosition(gun).y +V.y,EntityPosition(gun).z +V.z); Now you should only point to the currect direction and translate. Quote Intel Corei7-6700, NVIDIA GeForce GTX 980, 32GB DDR4, W-10. Link to comment Share on other sites More sharing options...
Marleys Ghost Posted April 6, 2010 Share Posted April 6, 2010 What sort of "bullet"? an actual entity or just a picked point and add force ? I am actually in the middle of converting/updating a test project I did last year in C++. Original thread here. Here the bullets are picks then adding a force at that point. Quote AMD Bulldozer FX-4 Quad Core 4100 Black Edition 2 x 4GB DDR3 1333Mhz Memory Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5 Windows 7 Home 64 bit BlitzMax 1.50 • Lua 5.1 • MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro 3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET LE 2.5/3.4 • Skyline • UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0 Marleys Ghost's YouTube Channel • Marleys Ghost's Blog "I used to be alive like you .... then I took an arrow to the head" Link to comment Share on other sites More sharing options...
Joh Posted April 6, 2010 Share Posted April 6, 2010 You used reaycast and then addforceatpoint right? Strangly when you "disabled" the gravity the already sleeping physics body wasn't effected.. I think you'll need to loop into all those body to reactive them. Am i right? Quote Intel Corei7-6700, NVIDIA GeForce GTX 980, 32GB DDR4, W-10. Link to comment Share on other sites More sharing options...
Marleys Ghost Posted April 6, 2010 Share Posted April 6, 2010 Strangly when you "disabled" the gravity the already sleeping physics body wasn't effected Newton's laws of motion ... a body at rest and all that .. plus the Zero G just made the demo download on the old thread that more much fun to play with Quote AMD Bulldozer FX-4 Quad Core 4100 Black Edition 2 x 4GB DDR3 1333Mhz Memory Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5 Windows 7 Home 64 bit BlitzMax 1.50 • Lua 5.1 • MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro 3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET LE 2.5/3.4 • Skyline • UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0 Marleys Ghost's YouTube Channel • Marleys Ghost's Blog "I used to be alive like you .... then I took an arrow to the head" Link to comment Share on other sites More sharing options...
Marleys Ghost Posted April 7, 2010 Share Posted April 7, 2010 Strangly when you "disabled" the gravity the already sleeping physics body wasn't effected.. I think you'll need to loop into all those body to reactive them. Am i right? yeah, simply loop through the scene and "jiggle" them to wake 'em up. I'll modify later the simple turning off of the worlds gravity and give it the "hollywood()" treatment when I get 5 mins and post the result .. @ cassius : how are you getting on with your bullets? Quote AMD Bulldozer FX-4 Quad Core 4100 Black Edition 2 x 4GB DDR3 1333Mhz Memory Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5 Windows 7 Home 64 bit BlitzMax 1.50 • Lua 5.1 • MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro 3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET LE 2.5/3.4 • Skyline • UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0 Marleys Ghost's YouTube Channel • Marleys Ghost's Blog "I used to be alive like you .... then I took an arrow to the head" Link to comment Share on other sites More sharing options...
Joh Posted April 7, 2010 Share Posted April 7, 2010 Nice i like those effect In past i worked on a "gravity granade" wich was quite funny.. Quote Intel Corei7-6700, NVIDIA GeForce GTX 980, 32GB DDR4, W-10. Link to comment Share on other sites More sharing options...
Marleys Ghost Posted April 7, 2010 Share Posted April 7, 2010 A quick test of waking up entity physics bodies when turning off the gravity of a world. Went a bit over the top with the number of test barrels for such a simple test. 144 was I think overkill. Quote AMD Bulldozer FX-4 Quad Core 4100 Black Edition 2 x 4GB DDR3 1333Mhz Memory Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5 Windows 7 Home 64 bit BlitzMax 1.50 • Lua 5.1 • MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro 3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET LE 2.5/3.4 • Skyline • UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0 Marleys Ghost's YouTube Channel • Marleys Ghost's Blog "I used to be alive like you .... then I took an arrow to the head" Link to comment Share on other sites More sharing options...
Joh Posted April 7, 2010 Share Posted April 7, 2010 Nice! But i think we are a little out of topic If you create your own topic i will write there. Quote Intel Corei7-6700, NVIDIA GeForce GTX 980, 32GB DDR4, W-10. Link to comment Share on other sites More sharing options...
Marleys Ghost Posted April 7, 2010 Share Posted April 7, 2010 I'm just killing time waiting on cassius lol Quote AMD Bulldozer FX-4 Quad Core 4100 Black Edition 2 x 4GB DDR3 1333Mhz Memory Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5 Windows 7 Home 64 bit BlitzMax 1.50 • Lua 5.1 • MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro 3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET LE 2.5/3.4 • Skyline • UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0 Marleys Ghost's YouTube Channel • Marleys Ghost's Blog "I used to be alive like you .... then I took an arrow to the head" Link to comment Share on other sites More sharing options...
cassius Posted April 7, 2010 Author Share Posted April 7, 2010 Firing bulletets in the required direction is my only prob in this thing. I got the gun set in position and sound effect. I suppose you could use an entity of a bullet and make it invisible, you could also have crosshairs and use that as a target. Quote amd quad core 4 ghz / geforce 660 ti 2gb / win 10 Blender,gimp,silo2,ac3d,,audacity,Hexagon / using c++ Link to comment Share on other sites More sharing options...
Marleys Ghost Posted April 7, 2010 Share Posted April 7, 2010 well unless you really need the end of the gun to be the point of origin use the camera as the origin and pick a Z distance to the centre of the screen, when the pick hits an entity addforce at that point. No need for invisible bullets, angle the gun model if thats what you are using toward the screen centre for effect. Quote AMD Bulldozer FX-4 Quad Core 4100 Black Edition 2 x 4GB DDR3 1333Mhz Memory Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5 Windows 7 Home 64 bit BlitzMax 1.50 • Lua 5.1 • MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro 3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET LE 2.5/3.4 • Skyline • UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0 Marleys Ghost's YouTube Channel • Marleys Ghost's Blog "I used to be alive like you .... then I took an arrow to the head" Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.