cassius Posted November 28, 2013 Share Posted November 28, 2013 Hi Whats the best way to fire bullets in a game? I assume they don't actualy fly through space. 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...
Rick Posted November 28, 2013 Share Posted November 28, 2013 2 common ways. Ray cast which is instant or an actual physics object that would more simulate an actual bullet. I find ray cast to be easier and less to deal with. Quote Link to comment Share on other sites More sharing options...
cassius Posted November 29, 2013 Author Share Posted November 29, 2013 If raycasting is used how do you determine when a hit has been made so that the character can fall? 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...
Rick Posted November 29, 2013 Share Posted November 29, 2013 You cast a ray and get the entity it hit. Then find out what that entity is somehow. You can set an entity key for all your entites and read that key from the hit entity. Quote Link to comment Share on other sites More sharing options...
Josh Posted November 29, 2013 Share Posted November 29, 2013 Use hit boxes and go up the entity hierarchy to get the topmost parent. I'm coding this right now for the 3.1 lessons 1 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
cassius Posted November 29, 2013 Author Share Posted November 29, 2013 Ah! That's usefull to know. 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...
Josh Posted November 30, 2013 Share Posted November 30, 2013 Here's a video about exactly this subject: http://www.leadwerks.com/werkspace/page/videos/_/-r223 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
nate066 Posted November 30, 2013 Share Posted November 30, 2013 Here's a video about exactly this subject: http://www.leadwerks.com/werkspace/page/videos/_/-r223 Are the lessons going to be video or written tutorials? Thanks for putting in the work to make fresh tutorials Quote Link to comment Share on other sites More sharing options...
Josh Posted November 30, 2013 Share Posted November 30, 2013 Both. It's all going to be focused on first-person shooter mechanics. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
nate066 Posted November 30, 2013 Share Posted November 30, 2013 Both. It's all going to be focused on first-person shooter mechanics. Awesome that's a fun topic. And how leadwerks 3.1 coming Quote Link to comment Share on other sites More sharing options...
ZioRed Posted December 3, 2013 Share Posted December 3, 2013 I tried to use the hitbox like suggested here (created a box with the editor tool, applied material "invisible.mat", set collision type "trigger" and "swept collision") and throw towards it a bullet model with collision type Prop, mass 1, swept collision and apply force, but for some reason I haven't any collision logged in my hook (also if I set collision type "prop" to the hitbox it still doesn't react to the bullet). By the way, the model containing the hitbox is stored in the scene, the bullet is of course instantiated at runtime with Model::Load. Is there something more that I need to setup to correctly handle collisions on objects? Quote ?? FRANCESCO CROCETTI ?? http://skaredcreations.com Link to comment Share on other sites More sharing options...
Rick Posted December 3, 2013 Share Posted December 3, 2013 I didn't watch Josh's video but I would think you want to use raycasting for the bullet and find out what hitbox it collided with instead of using a "real" bullet. Quote Link to comment Share on other sites More sharing options...
Naughty Alien Posted December 3, 2013 Share Posted December 3, 2013 ..for short range bullets, Ill go with raycasting, as you could assume that bullet goes in straight line trajectory in near instant time..for long range shots, ill use physics or calculated curved path of projectile, where projectile will still use raycasting, every time new position/alignment on calculated curve is updated.. Quote Link to comment Share on other sites More sharing options...
Josh Posted December 3, 2013 Share Posted December 3, 2013 Definitely go with raycasting. Set the character model pick mode itself to zero so you can collide with the hit boxes, not the model geometry. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
ZioRed Posted December 3, 2013 Share Posted December 3, 2013 I'm not making FPS, but platformer/sidescroller where units shot bullets around the screen so the damage has to be applied when the bullet hits the target and not when you shoot. I'll try to use raycast as well during the bullet flight like NA says for his "long distance" shot, thanks. Quote ?? FRANCESCO CROCETTI ?? http://skaredcreations.com Link to comment Share on other sites More sharing options...
YouGroove Posted December 4, 2013 Share Posted December 4, 2013 Some function like CollisionEnter() would help, don't know if it can be done in Newton 3 ? Quote Stop toying and make games Link to comment Share on other sites More sharing options...
Rick Posted December 4, 2013 Share Posted December 4, 2013 I am sort of shocked that Newton doesn't have some kind of on enter collision. Quote Link to comment Share on other sites More sharing options...
Naughty Alien Posted December 5, 2013 Share Posted December 5, 2013 ..i will not rely on to physics for this kind of things, especially once frame rate start to be variable.. Quote Link to comment Share on other sites More sharing options...
YouGroove Posted December 5, 2013 Share Posted December 5, 2013 Lot of games use that function without problem ,why shoud not rely on it ? Depends if your physic engine implement that well for all cases or not. It's usefull indeed for any triggers and enter contact of different objects, character entities. Perhaos some new functionnality to submit to Newton 3 forums ? Quote Stop toying and make games Link to comment Share on other sites More sharing options...
ZioRed Posted December 6, 2013 Share Posted December 6, 2013 I don't understand... shouldn't it call CollisionHook? Else, what should I use CollisionHook for? Quote ?? FRANCESCO CROCETTI ?? http://skaredcreations.com Link to comment Share on other sites More sharing options...
Naughty Alien Posted December 6, 2013 Share Posted December 6, 2013 Lot of games use that function without problem ,why shoud not rely on it ? Depends if your physic engine implement that well for all cases or not. It's usefull indeed for any triggers and enter contact of different objects, character entities. Perhaos some new functionnality to submit to Newton 3 forums ? ..reason why you dont want physics engine to deal with this is called Frame Rate vs. Object Speed. There is no physics engine, fixed this issue yet. Its basically number of moments in time per second when physics is calculated. Each frame is treated as separate from all other frames, and the space between frames is not calculated. A low framerate and a small fast-moving object leads to a situation where the object does not move smoothly through space but in fact seems to teleport from one point in space to the next point in space as each frame is calculated. At sufficiently high speeds a projectile will miss a target, if the target is small enough to fit in the gap between the calculated frames of the fast moving projectile. So, the most viable way is to calculate trajectory what will fit within non calculated frames, and use raycast to check objects for collision, once that particular frame is calculated with new position. Thats what AAA games using most of the time. One i know 100% is ratchet and Clank as i have full source of entire game as well as Uncharted. 3 Quote Link to comment Share on other sites More sharing options...
macklebee Posted December 6, 2013 Share Posted December 6, 2013 The hit boxes in what Josh is talking about are non physics based. They are just "models". I believe Raycasting goes against "models" and not physics. If you wanted to use a physics bullet then you'd need physics shapes. hmmm thats odd since raycasting in any engine I have ever tried is physics based, and still it appears to be this way in LE3 which makes sense since its derived from newton. if you look at Josh's video again, you will see that its a rigidbody that he was attaching to the bones as a hitbox. Unless LE3 also gives physic entities coloring as well, then i suspect the hitbox mesh you see is just to make it obvious what he was doing. Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
Rick Posted December 6, 2013 Share Posted December 6, 2013 In LE 2 I thought raycasting was done on the geometry which was why when we had complex character models the first time delay raycast bug was there. I guess now that you say that LE 2 automatically created the physics model based on the actual model so yeah you are right. Sorry, I've removed my statement as to not confuse the matter. Quote Link to comment Share on other sites More sharing options...
SarperSoher Posted December 6, 2013 Share Posted December 6, 2013 Lot of games use that function without problem ,why shoud not rely on it ? Depends if your physic engine implement that well for all cases or not. It's usefull indeed for any triggers and enter contact of different objects, character entities. Perhaos some new functionnality to submit to Newton 3 forums ? Physics have a fixed timestep, they are not updated every frame. When framerate drops, physics update intervals increase, rigidbodies and other physics stuff gets updated less. Rigidbodies start to move erratically, collision events on moving rigidbodies do not happen correctly etc. Quote Link to comment Share on other sites More sharing options...
macklebee Posted December 6, 2013 Share Posted December 6, 2013 the delay was due to for some reason that LE2 had a separate setup for so-called "raycast structures" than from the PHY bodies... which was odd, because talking to Julio Jerez they should have been one and the same object/entity. I am not sure how josh resolved that in his implementation - either by fixing the disparity or actually performing a raycast internally on every entity loaded into a scene... 1 Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel 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.