[BloodyMess]Red cube and getforce ?

ironwolf151

25-05-2009 14:22:54

Hi,

I'm here because i have 2 troubles :s
The first one is when i use the NxOgre debugger.
Indeed , like i explained it in my last posts , i'm trying to do a game where we rotate plane to move the ball.
It works , i changed the gravity according to the angle of the plane , but if i stop the ball (after i have moved it) a red cube appear on the ball , and the ball don't move anymore.
I can rotate the plane all i want , the ball will not move.



So my question is : What means this red cube and why does it appear when i stop the ball ?


The second problem is easier i think , i would like to know the speed of my Ball ( which is a OGRE3DBody ) , but i don't find any method to get it.
Is it possible to know it ?

Thanks a lot for your help.

betajaen

25-05-2009 16:36:41

It could be the bounding box, but I believe that's the yellow one. Perhaps it's the shape's bounding box in the actors local pose. I would also wake up the actor for several seconds when you change the gravity. The reason why it's not moving is probably that - it's asleep.

As for speed; mBall->getLinearVelocity().magnitude() * 3.6 will get the Ball's velocity measured in KPH.

ironwolf151

25-05-2009 16:38:51

Okay thanks ;)

ironwolf151

25-05-2009 18:39:06

Indeed , the red cube appear when the Ball is sleeping.
So i tried to wake it up with this method : wakeUp(20 * 0.02);
But i obtain an error durong the compilation :

Error 2 error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall NxOgre::Actor::wakeUp(float)" (__imp_?wakeUp@Actor@NxOgre@@QAEXM@Z) referenced in function "public: void __thiscall Scene::Rotate_plane(float,float)" (?Rotate_plane@Scene@@QAEXMM@Z) Scene.obj

I guess it's an link error , but i have linked all correctly , moreover there are no problems with the method isSleeping();

All the .dll are in my bin directory.

Do you have an idea about the problem ?

spacegaier

25-05-2009 19:07:21

Do you have an idea about the problem ?
Yes, I do :) .

That's what the function looks like in NxOgreActor.cpp
///void Actor::wakeUp(Real wakeCounterValue)
///{
///}

So the linker can't find it as it isn't there (and wouldn't do anything if it was).

Perhaps have a look at the PhysX SDK and how they did it there and try to implement it on your own or wait until betajaen sees it here and fixes it.

ironwolf151

25-05-2009 19:36:09

Indeed , it's a good reason ^^

I'm looknig in the SDK , but it seems to be really hard for me to do what i want.
So i'm looking if it's possible to prevent sleep of actors.

I have a problem with the velocity too.
The answer gave me Betajaen works, but in reality i would set a speed limit.
For exemple i don't want my ball can roll more than 10 KPH , how can i do ?

I tried this , but it's not a good solution because if my ball reach the speed limit , so it continue in the last direction and not in the new direction.

if (this->_Scene->_Ball->getLinearVelocity().magnitude() > 3.0)
this->_Scene->_Ball->setLinearVelocity(this->_LastVelocity);
this->_LastVelocity = this->_Scene->_Ball->getLinearVelocity();

betajaen

25-05-2009 19:51:56

I noticed it the other day, and quickly implemented it.

I would release NxOgre but there is a half-finished feature which I want to surprise everyone with.

So if your confident to implement it yourself, this is the code to do it.

void Actor::wakeUp(Real wakeCounterValue)
{
::NxOgre_Namespace::Functions::RigidBodyFunctions::wakeUp(wakeCounterValue, mActor);
}

void Actor::putToSleep(void)
{
::NxOgre_Namespace::Functions::RigidBodyFunctions::putToSleep(mActor);
}



As for limiting velocity; I would try and come up with a force to limit it. Something along the lines of

force = -velocity * mass

Otherwise; I would play around with linear (or possibly angular) damping and increase it when it reaches your speed threshold.

ironwolf151

26-05-2009 00:26:02

Thanks it works :)