(C++) WoW style custom controls with camera and more

Post those lines of code you feel like sharing or find what you require for your project here; or simply use them as tutorials.
jreuschel1
Posts: 25
Joined: Sun Nov 12, 2006 7:51 pm
Contact:

(C++) WoW style custom controls with camera and more

Post by jreuschel1 »

Here is my WoW style Biped controller and camera code

with this you can make a .md2 file walk, strafe, jump, crouch, and possibly in the future, swim



It has ground (terrain) collision detection and gravity

unfortunately, not very well documented, but not extremely complicated


controls for demo:
WASD for direction, mouse to aim, hold shift to run, space to jump and C
to crouch, mouse Left+right walk forward, hold mouse right to strafe, hold mouse left to move camera


Sorry there is no documentation as this is a work in progress...



Here are some things you can do in your own programs:
Set Animation Frame Sets for your model for each state of motion (Jumping, running, strafing, etc.)
Set Gravity value
Set Jump Force
Set Walk and Run Speeds
Customize control Keys (not mouse)




here are the links to source and demo


http://jreuschel1.tripod.com/irrlicht.htm
Last edited by jreuschel1 on Sun Sep 02, 2007 4:04 pm, edited 2 times in total.
m_krzywy
Posts: 133
Joined: Sat Nov 04, 2006 2:05 pm

Post by m_krzywy »

This file is hosted by Tripod, a LycosŽNetwork Site, and is not available for download. Please check out Tripod's Help system for more information about Remote Loading and our Remote Loading policy.




Dead link :(
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

I have no problems to download the files...
(right click - save target as)
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
kompromis
Posts: 98
Joined: Mon Sep 11, 2006 2:36 pm
Location: sweden/stockholm

Post by kompromis »

just enter the link in the adress field insted
and it will work just fine
lukluk
Posts: 4
Joined: Mon Mar 19, 2007 9:26 pm

Post by lukluk »

Help i cant compile that :/ i have error HELP !
shadowlancer
Posts: 1
Joined: Mon Mar 26, 2007 7:59 am

Post by shadowlancer »

help i cannot download the fiel
varholl
Posts: 22
Joined: Thu Jul 12, 2007 6:59 pm
Location: Argentina
Contact:

Post by varholl »

I can't believe it!!! this is was i was trying to get in my game!!!! i tested it and it works incredibly perfect!!!!!!! Thanks man!!!!!!!!!!!!!!!!!!!!!!!

Greeting from Argentina!!!
A caos world where only the strongest lives, weak is not an option... you must fight.. Nokturna!!

http://nokturna.varholl.com.ar
MasterGod
Posts: 2061
Joined: Fri May 25, 2007 8:06 pm
Location: Israel
Contact:

Post by MasterGod »

Can't download...
Image
Dev State: Abandoned (For now..)
Requirements Analysis Doc: ~87%
UML: ~0.5%
xsocom
Posts: 80
Joined: Thu Sep 13, 2007 8:34 am

Post by xsocom »

Nice work! Keep it up

Cheers!
Last edited by xsocom on Tue Oct 23, 2007 8:09 pm, edited 1 time in total.
KakashiXP
Posts: 24
Joined: Mon Oct 08, 2007 4:38 pm
Location: a really big box
Contact:

Post by KakashiXP »

it didnt work for me also, but when i opened the link with Internet Explorer, it works fine... so just try that :D 8)
remember kids, you are what you eat :-)
and... look everybody, its hitler buddy!

Image
xsocom
Posts: 80
Joined: Thu Sep 13, 2007 8:34 am

Post by xsocom »

Add smooth camera zooming in the MovePlayerControll :]

add:

Code: Select all


const float CamSpeed = 3.15f;
const float CamUpdateSpeed = 0.005f;

float CamZoomOffset = 100.0f;

if(MWHEEL!=0)
{
   CamZoomOffset += CamSpeed * MWHEEL * ElapsedTime;
		
   if(CamZoomOffset < 10.0f )CamZoomOffset = 10.0f;
   if(CamZoomOffset > 200.0f )CamZoomOffset = 200.0f;

   MWHEEL = 0;
}

CamZoom += ( CamZoomOffset - CamZoom ) * CamUpdateSpeed * ElapsedTime;
Maybe not the best way to do it but it works :P
Last edited by xsocom on Tue Oct 23, 2007 7:45 pm, edited 3 times in total.
xsocom
Posts: 80
Joined: Thu Sep 13, 2007 8:34 am

Post by xsocom »

Hm I played wow for a while and one more thing about the camera, when you rotate around your player the camera rotates back behind the player when you lift the mouse button up, or something like that..

Well use the same thing here, it works but also not the best way to do it :P

Code: Select all

void ResetCamera( float ElapsedTime )
{
   CamPan += ( CamReset - CamPan ) * 0.005f * ElapsedTime;
}
and above the WSAD1.Tick( .. ) in the end of the code.

Code: Select all

if( MBLEFT==0 )
{
   ResetCamera( ElapsedTime );
}
also add some sort of rotation check under "CamPan=CamPan+(MOUSEX-OLDMPOSX)/3.0f; "

Code: Select all

if( CamPan >= 360.0f ){
   CamPan = 0.0f;
}
if( CamPan < -360.0f ){
   CamPan = 0.0f;
}
Cheers :P
xsocom
Posts: 80
Joined: Thu Sep 13, 2007 8:34 am

Post by xsocom »

Just one more thing I need to for camera is to make it adjust agains the terrain like in WoW, any tips :)?
WarShattrith
Posts: 6
Joined: Wed Oct 17, 2007 5:07 pm

Post by WarShattrith »

Make at the camera position a small box. Then collide this box with the terrain. Finally, position the camera to the box.
xsocom
Posts: 80
Joined: Thu Sep 13, 2007 8:34 am

Post by xsocom »

any sample on how you do it? sounds simple as you said it, but I think its a little more komplicated, get an smooth terrain collision is hard I think.
Post Reply