Jump to content

Recommended Posts

Posted

Hi

 

Whats the best way to fire bullets in a game? I assume they don't actualy fly through space.

amd quad core 4 ghz / geforce 660 ti 2gb / win 10

Blender,gimp,silo2,ac3d,,audacity,Hexagon / using c++

Posted

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.

Posted

If raycasting is used how do you determine when a hit has been made so that the character can fall?

amd quad core 4 ghz / geforce 660 ti 2gb / win 10

Blender,gimp,silo2,ac3d,,audacity,Hexagon / using c++

Posted

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.

Posted

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

  • Upvote 1

My job is to make tools you love, with the features you want, and performance you can't live without.

Posted

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?

?? FRANCESCO CROCETTI ??

http://skaredcreations.com

Posted

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.

Posted

..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..

 

Posted

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.

My job is to make tools you love, with the features you want, and performance you can't live without.

Posted

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.

?? FRANCESCO CROCETTI ??

http://skaredcreations.com

Posted

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 ?

Stop toying and make games

Posted

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.

  • Upvote 3

 

Posted

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.

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Posted

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.

Posted

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.

Posted

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...

  • Upvote 1

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...