Jump to content

FPS Controller problem..


Chiblue
 Share

Recommended Posts

I am using gamelib to create my FPS controller, I have been playing around with different types of weapons, and using rifles or longer barrel weapons everything runs fine, but today I built a pistol into the game and are experiencing some strange events... when I move the weapon up and down when it gets towards level the mesh disappears, I believe this is something to do with it passing through the controller mesh.... when I use a rifle this is long enough and is always passing through the controller mesh... could this be the problem or is something else happening.. there is no animation played at this point that is different than the up or down position?

 

Any suggestions would be appreciated...

If it's not Tactical realism then you are just playing..

Link to comment
Share on other sites

The mesh bounding box might not match the range of the animation, if it is an animated mesh.

 

I am confused... I do not have a bounding box, I have not set any collisions on the animated object.. or is there a different bounding box I should be considering?

If it's not Tactical realism then you are just playing..

Link to comment
Share on other sites

It cannot be the CameraRange as it will disappear as the camera rotates, even so I did change this to near = 0.01f and still have the problem... Although if I change the camerazoom to say 1 it works, if I chage it to 1.1 it disappears when level... if I set the model z to say 0.1f it works so long as the zoom is low, i.e. <1.5... so this is obviously something going on with the camera render, not sure what it does not look like culling as the entire model disappears..

If it's not Tactical realism then you are just playing..

Link to comment
Share on other sites

Turn on the 'Show Boxes' in the Options' Display tab of the Editor. That will show your bounding box.

 

Bounding box contains the model at all points in hte animation as far as I can tell in the editor..

 

Also given that the animation is static at a specific frame and is not changing if the bounding box was the issue would this not cause the weapon to disapear all the time?

If it's not Tactical realism then you are just playing..

Link to comment
Share on other sites

This is definitely a camera issue I added a second camera to follow and view the controller and the mesh shows perfectly with all animation. I changed the camera near setting which had no perceivable affect the only things that affect it are the zoom and moving the model forward on the z. I checked all camera setting and see nothing unless there as something inside le that is impacting this?

If it's not Tactical realism then you are just playing..

Link to comment
Share on other sites

No one can help you unless you post some code demonstrating your problem.

 

Given the size of the project... I cannot provide it all, but these are the specific parts...

 

Declaring the mesh..weapon class setup..

 

  modelhud = LoadMesh(hudmesh);

 

This code is called when a weapon is selected by the player..

 

TWeapon *weap = &weaponslot[currentweapon].weapon;
EntityShadowMode(weap->modelhud,false);
ScaleEntity(weap->modelhud,Vec3(weap->GameScale,weap->GameScale,weap->GameScale));
EntityParent(weap->modelhud, cam);
PositionEntity(weap->modelhud,EntityPosition(cam,1),0);
TVec3 rot = EntityRotation(cam,0);
RotateEntity(weap->modelhud,Vec3(rot.X+weap->rotatex,rot.Y+weap->rotatey,rot.Z+weap->rotatez),0);
TranslateEntity(weap->modelhud,Vec3((flt)weap->horiz,(flt)weap->vert,(flt)weap->forward),0);
ShowEntity(weap->modelhud);
EntityOcclusionMode(weap->modelhud,0);
EntityType(weap->modelhud,11);
CameraZoom(cam,weap->stdzoom);
weaponstatus = ready;
firingstep = 0;
animwait = false;
SetFPSAnimation("draw");

 

This is the code that rotates the camera...

 

TPlayer *pla = scene.currentplayer;
TWeapon *weap = pla->GetWeapon();
mx=Curve((flt)MouseX()-scene.cx,mx,4);
my=Curve((flt)MouseY()-scene.cy,my,4);
CenterMouse();
camrot=EntityRotation(cam);
camrot.X+=my*scene.GetCurrentPlayer()->turnspeedY/camzoomcurrent;
camrot.X=Clamp(camrot.X,mincamXangle,maxcamXangle);
camrot.Y-=mx*scene.GetCurrentPlayer()->turnspeedX/camzoomcurrent;
camrot.Z=0;
RotateEntity(cam,camrot);
RotateEntity(scene.GetCurrentPlayer()->campivot,camrot,1);

 

This code was mainly adapted from the Gamelib.. so you will see many similarities..

 

Please let me know if you need any further explanation?

If it's not Tactical realism then you are just playing..

Link to comment
Share on other sites

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.

 Share

×
×
  • Create New...