[Bleeding] - setGlobalOrientation Problem to rotate 90°

almondega

01-09-2008 05:15:09

hi
i'm trying to shot a capsule in my fps game
but i dont know how to rotate the actor (bullet) like this screen:



here is the code to put the bullet in front of the gun
actor->setGlobalPosition(mActor->getGlobalPositionAsOgreVector3() - ((mCamYawNode->getOrientation() * mCamPitchNode->getOrientation()) * Vector3(0,0,4)));

actor->setGlobalOrientation(mCamYawNode->getOrientation() * mCamPitchNode->getOrientation());


the second line of the code is the Quaternion orientation, with faces the capsule to the camera, but i need to face in a horizontal way, like the screen

how to do that?
tks :roll:

mcaden

01-09-2008 07:26:36

I'm not sure how to do it in code. I'd have it rotated before loading into NxOgre.

Just an aside, why use a capsule? For a bullet a sphere will do just fine usually.

almondega

01-09-2008 07:35:39

a sphere should work =]
tks

Jallen

02-09-2008 15:33:22

Who uses solids for bullets!?
Nearly EVERY game uses rays, simply because they are instant, which is like a bullet (moves so fast it may as well be instant in most cases).

The disadvantage of using solid shapes is that if they move too fast, they will go through things, because, as you would expect, when it moves, it's just a repositioning of that object. If it moves too fast then it won't intersect with other solids and therefore wont get a collision.

Use rays for a gun unless it shoots projectiles (like a rocket launcher).

Also, you can use a bullet model for the visuals just fine, but use a plane (simplest primitive) for the collision.

mcaden

02-09-2008 16:32:29

good point.

I haven't done an FPS before, but using a ray definitely makes sense unless you're trying to be super-realistic and plot it along a curve based on wind resistance, bullet shape, etc...which a game probably wouldn't try to do.

betajaen

02-09-2008 17:11:41

If the gun is a musket, then the projectile would travel slower than a bullet. That way you could use a sphere (with CCD) and take advantage of the bullet bouncing of walls and responding to gravity - something you can't do with a ray.

Prophet

02-09-2008 17:15:43

Say you use betajaen's musket. How fast should the maximum velocity be? (Under "normal" conditions)

reptor

02-09-2008 22:48:37

good point.

I haven't done an FPS before, but using a ray definitely makes sense unless you're trying to be super-realistic and plot it along a curve based on wind resistance, bullet shape, etc...which a game probably wouldn't try to do.


Look for example at PC games Operation Flashpoint and Armed Assault, both made by Bohemia Interactive Studio...

they simulate bullet drop, wind affecting the bullets, and their bullets travel at the speed the real bullet of the specific gun would travel at.

The bullets are *not* instantly (or almost) hitting their targets. If the target is far away and is moving, you need to carefully estimate where the target is when the bullet would hit it, and adjust your aiming "past" the target to correct for it. I think this is difficult to do if rays are used.

I think if those things are not simulated, at least the bullet drop, and the time it takes from the bullet to reach its target, the game is going to suck. If distance makes no difference. Well, maybe some sci-fi game can leave those out. A sci-fi scene where real physics don't exist.

In Armed Assault also a "supersonic crack" is simulated, but *only* when the bullet's speed goes supersonic. You can hear it on the battlefield when it happens.

almondega

03-09-2008 02:04:21

wow
tks for the replies guys

i play a lot of fps games
and this last generation games, the bullet are not rays (they dont have mesh, but the bullet had a time to reach long targets)

but I thought about the bullet speed witch can cause a not intersection, due the high speed
take medal of honor airborne, when u upgrade your skills, the game goes to a slow motion play, and u can see (the line) and the sound of the bullets going through you
also, the FPS online Combat Arms, u can see this same line (witch represents the bullet fire) travelling around the map)

so, this CCD (witch betajaen talks about) will fix it, will ensure that the bullet will be intercepted by a wall?
i'll search about it

tks

EDIT: CCD - Continuous Collision Detection... not yet implemented in NxOgre am i right =\ ?
SOLUTION: RayCaster for now, until CCD isnt ready