Ambiera ForumDiscussions, Help and Support. |
|
|
|||||
|
I have my character controller almost exactly as I want him (so far). However, I am having an issue with jumping. I am using the javascript jumping script and it works great, except that the user can keep pressing the spacebar which keeps jumping and gaining altitude. How can we only allow the spacebar be pressed one time per jump? Here are the two code fragments (put in the main scene node): When a key is pressed do something: and Every few seconds do something: Thanks for the help. Mike |
||||
|
You can shoot rays from the bottom of your feet.Then calculate the distance between the two points。 |
||||
|
If I could shoot rays from the bottom of my feet, i'd be a super hero or villian. Ummmmm - please explain what you mean by shooting rays. What commands would I use? Possibly a code chunk for help? While I appreciate the suggestion, it means little to nothing to me since I'd have no idea how to shoot rays from any part of my body (and yes, I know you are talkng about my 3rd person player character's feet). Mike |
||||
|
var start=new CL3D.Vect3d(pos.x,pos.y+5,pos.z); var end=new CL3D.Vect3d(pos.x,pos.y-100,pos.z); for (var g = 0; g < scene.CollisionWorld.Selectors.length; ++g) { var l = scene.CollisionWorld.Selectors[g].getCollisionPointWithLine(start,end,true,null,true); if (l != null) { var f = l.getDistanceFromSQ(start); if (f < 999999999.9) { var objName=scene.CollisionWorld.Selectors[g].Node.Name; //... } } } |
||||
|
wrote: var start=new CL3D.Vect3d(pos.x,pos.y+5,pos.z); var end=new CL3D.Vect3d(pos.x,pos.y-100,pos.z); for (var g = 0; g < scene.CollisionWorld.Selectors.length; ++g) { var l = scene.CollisionWorld.Selectors[g].getCollisionPointWithLine(start,end,true,null,true); if (l != null) { var f = l.getDistanceFromSQ(start); if (f < 999999999.9) { var objName=scene.CollisionWorld.Selectors[g].Node.Name; //... } } } damn, that is some nice code...never knew about that and I am making a game...doh. If I didn't know about that code I would create a new variable on start and time delay from start of jump till after set time allow jumping again..whatever works.. |
||||
|
wrote: var start=new CL3D.Vect3d(pos.x,pos.y+5,pos.z); var end=new CL3D.Vect3d(pos.x,pos.y-100,pos.z); for (var g = 0; g < scene.CollisionWorld.Selectors.length; ++g) { var l = scene.CollisionWorld.Selectors[g].getCollisionPointWithLine(start,end,true,null,true); if (l != null) { var f = l.getDistanceFromSQ(start); if (f < 999999999.9) { var objName=scene.CollisionWorld.Selectors[g].Node.Name; //... } } } Wow. Thank you. Any way to explain what this does and where to put it? Thanks. Mike |
|