KyleKatarn
25-11-2009 01:16:23
*Raycasting
=========
Hello again, friendly NxOgre community.
We've finally figured out jumping and raycasting and whatnot (courtesy of my teammate Danoli3), now we've hit a snag, it seems when we jump into a wall, while moving forward, the downward motion of gravity is not being applied at all, just the forward motion. I figured we could use another raycast, shot from the players orientation and when it hits a wall, we set the linear velocity to 0.
this->getFacing() returns an Ogre::Vector2 of the players current orientation based off the mesh, because I've frozen all rotations on the physics body.
Anyway, the above generate an error:
Is this because I'm not supposed to use Vector2 fields in Vec3? If so, what would be a better practice? I have tried to port over the Vector2 to a Vector3 and I got the same error:
This is particularly mindblowing because it should work.
Any suggestions?
=========
Hello again, friendly NxOgre community.
We've finally figured out jumping and raycasting and whatnot (courtesy of my teammate Danoli3), now we've hit a snag, it seems when we jump into a wall, while moving forward, the downward motion of gravity is not being applied at all, just the forward motion. I figured we could use another raycast, shot from the players orientation and when it hits a wall, we set the linear velocity to 0.
NxOgre::Vec3 playerPos( pPhysicsBody->getGlobalPosition() );
NxOgre::RaycastHit pRayResult = pPhysScene->raycastClosestShape( NxOgre::Ray( playerPos, NxOgre::Vec3( this->getFacing().x, 0, this->getFacing().y )), NxOgre::Enums::ShapesType_Static );
this->getFacing() returns an Ogre::Vector2 of the players current orientation based off the mesh, because I've frozen all rotations on the physics body.
Anyway, the above generate an error:
Error 1 error C2228: left of '.x' must have class/struct/union c:\cpp-y2\code\visual studio 2008\ogre\mall rush\dependencies\nxogre\sdk\NxOgreVec3.h 63 Player
Error 2 error C2228: left of '.y' must have class/struct/union c:\cpp-y2\code\visual studio 2008\ogre\mall rush\dependencies\nxogre\sdk\NxOgreVec3.h 63 Player
Error 3 error C2228: left of '.z' must have class/struct/union c:\cpp-y2\code\visual studio 2008\ogre\mall rush\dependencies\nxogre\sdk\NxOgreVec3.h 63 Player
Is this because I'm not supposed to use Vector2 fields in Vec3? If so, what would be a better practice? I have tried to port over the Vector2 to a Vector3 and I got the same error:
NxOgre::Vec3 playerPos( pPhysicsBody->getGlobalPosition() );
Ogre::Vector3 playerFacing( this->getFacing().x, 0, this->getFacing().y );
NxOgre::RaycastHit pRayResult = pPhysScene->raycastClosestShape( NxOgre::Ray( playerPos, NxOgre::Functions::XYZ<Ogre::Vector3, NxOgre::Vec3>(playerFacing)), NxOgre::Enums::ShapesType_Static );
This is particularly mindblowing because it should work.
Any suggestions?