simple moving a char (again sorry)

lonwolf

01-07-2006 12:31:19

hello ive been surfing this forum and i found some ideeas of movin a char
but i cant seem to put togheter a workin code..
i have a working simple gravity callback but i cant make a simple moving one: the reason HOW can i Calculate the direction/moving vector so i can add it to the body...
so my request is if there is someone who can show/give nice example of a movin calback that will drag the caracter and make him move forward whatever its orientation...

10xz in advance

Hansel

02-07-2006 10:20:09

You need to move the body using forces. For example:

// move forward

if (mInputDevice->isKeyDown(KC_UP))
{
Vector3 direction = ash->get_node()->getOrientation( ) * Vector3::UNIT_Z;
ash->get_body()->setVelocity(ash->get_body()->getVelocity()*Vector3(0,1,0) + direction*(10)*Vector3(1,0,1)*size_factor);

}



Try it :D

lonwolf

02-07-2006 10:50:32

thankz @Hansel ill try it a bit later when ill start working... lets hope thats gonna work [-o< :roll:

One question what is SIZE_FACTOR>??<

Hansel

02-07-2006 14:18:28

Forget size_factor, it`s a parameter to adjust the velocity of Ash according to his size :mrgreen:

lonwolf

03-07-2006 17:03:43

ok i tryed your code.. its awsome 10xz but its going backwards :lol: so i replaced UNIT_Z with NEGATIVE_UNIT_Z and is goin normal :wink: .

well... almo0st normal :? when it hits the ground (anyway it bounces :lol: ) and it starts rotating :?: seting up friction 0 and elasticity 0 :idea: with OgreNewt Materials will do the trick? :roll: :?:

if you have done that allready i could use some help :?

10xz

Hansel

03-07-2006 21:01:17


const MaterialID* material_ash = new MaterialID( world);
const MaterialID* material_floor = new MaterialID( world );


MaterialPair* material_pair = new OgreNewt::MaterialPair( world, material_ash, material_floor );


material_pair->setDefaultFriction( 0, 0 );
material_pair->setDefaultSoftness(1);
material_pair->setDefaultElasticity(0.1);
material_pair->setContinuousCollisionMode(0);


ash->get_body()->setMaterialGroupID(material_ash);
floor->get_body()->setMaterialGroupID(material_floor);



;)

lonwolf

03-07-2006 21:03:59

man u are a true helper 10xz a lot.. Ill trry that in the mornin cuz here its 22:55 pm :D what can i say more thankz a lot. i think there are about 4 of us that surf this forum daily :)

lonwolf

04-07-2006 12:36:33

man thanks a lot you saved me from 2 hours of searching throughout the forum and tutorials. If you need anything related to ogre or ogrenewt just ask becoz i have a huge prject :D with lots of things in it :D

Hansel

05-07-2006 11:03:57

What's you project? I have curiosity :D

lonwolf

05-07-2006 11:06:12

im makin a rpg/mmorpg game and its infrastructure its done after 6 months of work. And now we just have to make the models and programm the interaction with the enviroment :D
and now im workin on the AI :wink:

Hansel

05-07-2006 11:15:56

It sounds very complex, how many people are working with you? Do you have any artwork or screen? :mrgreen:

Hope you'll finish it well :D

lonwolf

05-07-2006 11:19:16

there are 3 of us and the release date is in september .. i dont know if im allowed to post the site but i hope no one will be mad on me

http://www.lhok.as.ro
there you can see some screenshots and later when we will implement other models in the game and the AI ill post new screens :D

Hansel

05-07-2006 11:44:41

I've probed the alpha version and the gui implementation looks very impressive. I like your work :D

Are those trees modelled in max?

lonwolf

05-07-2006 11:48:21

yes they are exported from max.. Its from the base vedetaion from max but later on well model one of our own.. and i found on some sites vegetation packs ... with tropical trees and ... eh.. very impresive..
Glad you like it :wink: ill hope to hear your opinion on the release :D
Btw which country are you from??? :D

Hansel

05-07-2006 13:03:04

I'm from Spain, and you? :mrgreen:


edit.- Bucharest? :D

lonwolf

05-07-2006 18:18:57

yeah, Romania :D keep up the good work.. and im on the way of implementing the AI.. its not that hard after i read some articles.. if u have probs related to this subject or other please feel free to ask ill help as much as i can :wink: