[C++] crouch ;)

Post those lines of code you feel like sharing or find what you require for your project here; or simply use them as tutorials.
Post Reply
Neku
Posts: 2
Joined: Wed Jul 26, 2006 1:23 am

[C++] crouch ;)

Post by Neku »

This is my way to get crouch when you pressed C

Code: Select all

//...
scene::ISceneNodeAnimatorCollisionResponse* anim =
    smgr->createCollisionResponseAnimator(
		selector, camera, core::vector3df(30,50,30),
		core::vector3df(0,-1,0),
		core::vector3df(0,10,0));
//...


//Sommes-nous accroupi ?
bool Crouch = false;

while(device->run())
	{
		
	if (device->isWindowActive())
	{
		//s'accroupir
		//On s'accroupi
		if (Receiver.getKeyState(KEY_KEY_C) && Crouch == false) 
		{ 
			Crouch = true;
			core::vector3df Radius = anim->getEllipsoidRadius();
			anim->setEllipsoidRadius(core::vector3df(Radius.X,Radius.Y - 20,Radius.Z));
		}
		//On se releve
		else if (!Receiver.getKeyState(KEY_KEY_C) && Crouch == true)
		{
			core::vector3df vCamPos = camera->getPosition(); 
			core::vector3df Radius = anim->getEllipsoidRadius();
			anim->setEllipsoidRadius(core::vector3df(Radius.X,Radius.Y + 20,Radius.Z));
			camera->setPosition(core::vector3df(vCamPos.X,vCamPos.Y + 20,vCamPos.Z));
			Crouch = false;
		}
//.....
}
}
stodge
Posts: 216
Joined: Fri Dec 05, 2003 5:57 pm

Post by stodge »

And?
Neku
Posts: 2
Joined: Wed Jul 26, 2006 1:23 am

Post by Neku »

stodge
Posted: Wed Jul 26, 2006 2:30 am Post subject:
And?
And ... Some poeple in beginer help ask about a croushing code ...
stodge
Posts: 216
Joined: Fri Dec 05, 2003 5:57 pm

Post by stodge »

Well, where does it crash? What does the debugger tell you?
Warchief
Posts: 204
Joined: Tue Nov 22, 2005 10:58 am

Post by Warchief »

He meant crouch, not crash.
dawasw
Posts: 357
Joined: Tue Aug 10, 2004 4:39 pm
Location: Poland

Post by dawasw »

Lol stodge XD
TheRLG
Posts: 372
Joined: Thu Oct 07, 2004 11:20 pm

Post by TheRLG »

SHOW ME THE MONEY!!!

Let's see a screenshot, use Sydney in Hello World example even.
dawasw
Posts: 357
Joined: Tue Aug 10, 2004 4:39 pm
Location: Poland

Post by dawasw »

That would done nothing RabidLockerGnome.

Too see it you need a level where even Sydney model could 'pass' a narrow tunnel.

Besides it's set up for camera - and setting it up for sydney in hello word program would only show a animation (If u have set keyframe lol).
Post Reply