four quick noobish questions

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Elazul
Posts: 38
Joined: Fri Mar 23, 2007 4:47 pm

four quick noobish questions

Post by Elazul »

Thanks to anyone that responds in advance;

1- i'm having a problem with the model sizes (using md2 models) they just seem to be smaller than usual , and i want to make them larger than they are, is scaling possbile? this is the code i'm using:
material.Textures[0] = driver->getTexture("../../media/faerie2.bmp");
material.Lighting = true;

scene::IAnimatedMeshSceneNode* faerienode = 0;
scene::IAnimatedMesh* faerie = smgr->getMesh("../../media/faerie.md2");

scene::IAnimatedMeshSceneNode* anms = smgr->addAnimatedMeshSceneNode(smgr->getMesh("../../media/faerie.md2"));

if (faerie)
{
faerienode = smgr->addAnimatedMeshSceneNode(faerie);
faerienode->setPosition(core::vector3df(3000*3,255*2,3700*2));
faerienode->setRotation(core::vector3df(1,75,1));
faerienode->setMD2Animation(scene::EMAT_SALUTE);
faerienode->getMaterial(0) = material;
}

2- I've added gravity to the terrain rendering map, and i've changed the scaling and height map to have some REALLY sharp rises (i.e Walls of texture) HOWEVER it's still possible to climb these... is there a way to stop this?

3- Collision with a model, i can detect the camera-model collision by following the tutorials, but the player and model can still occupy the same space... is there a way to stop this?

4- Jumping... is there a simple way to incorporate this through an eventhandler?

Thanks in advance, and i apologize if any of these questions were posted before, i used the search function and came up empty, so if there are any, i probably didn't use the right query.
Rytz
Posts: 249
Joined: Wed Oct 25, 2006 6:05 am
Location: IL, USA
Contact:

Re: four quick noobish questions

Post by Rytz »

Elazul wrote:1- i'm having a problem with the model sizes (using md2 models) they just seem to be smaller than usual , and i want to make them larger than they are, is scaling possbile?
On creation with addAnimatedMeshSceneNode you can set the scale as one of the parameters. I believe it's the last parameter. You can use setScale too, after the node has been created.

Elazul wrote:2- I've added gravity to the terrain rendering map, and i've changed the scaling and height map to have some REALLY sharp rises (i.e Walls of texture) HOWEVER it's still possible to climb these... is there a way to stop this?
Not sure on this one, sorry :(. Haven't used height maps yet.


Elazul wrote:3- Collision with a model, i can detect the camera-model collision by following the tutorials, but the player and model can still occupy the same space... is there a way to stop this?
Not sure on this one either... but this would be helpful for me too.
Elazul wrote:4- Jumping... is there a simple way to incorporate this through an eventhandler?
I could be wrong but I don't think there is anything pre-made for jumping but sounds like it would be fairly easy to impliment by adjusting the node on the y axis.

Sorry for not being able to answer all of the questions :).
Image
Elazul
Posts: 38
Joined: Fri Mar 23, 2007 4:47 pm

Post by Elazul »

Thanks , it's ok that you didn't know all the answers, but the first one helped alot (scaling)


however your response on the jumping, i attempted to add this in the event handler, and i it didn;t work. (note i was trying to use this to make me jump in place first, and then figure out a way to manipulate it in movement.)
case KEY_KEY_SPACE:
{
//camera->setPosition(core::vector3df(-100,50,-150));
}
Rytz
Posts: 249
Joined: Wed Oct 25, 2006 6:05 am
Location: IL, USA
Contact:

Post by Rytz »

Elazul wrote:Thanks , it's ok that you didn't know all the answers, but the first one helped alot (scaling)


however your response on the jumping, i attempted to add this in the event handler, and i it didn;t work. (note i was trying to use this to make me jump in place first, and then figure out a way to manipulate it in movement.)
case KEY_KEY_SPACE:
{
//camera->setPosition(core::vector3df(-100,50,-150));
}
Well, just thinking about it, you would need a boolean switch of some kind to tell if the player has jumped (hit the space bar) and then set a timer that would be used to calculate the amount of time to rise / fall over time.

Well I guess this entire scenario would be different if you are using the built in gravity. You would just need to make the node rise at a specific rate based on the amount of time elapsed with the timer.
Image
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

Assuming you already have collision response animator with gravity...

Code: Select all

  // add camera
  scene::ICameraSceneNode* camera = 
      smgr->addCameraSceneNodeFPS(0, // parent
                                  100.0f, // rotate speed
                                  100.0f, // movespeed
                                  -1,     // id
                                  0,      // key map array
                                  0,      // key map size
                                  false,  // no vertical movement
                                  .5f);  // jump speed
It doesn't work all that well, but it is built in.

Travis
Elazul
Posts: 38
Joined: Fri Mar 23, 2007 4:47 pm

Post by Elazul »

but then what's the button associated with jumping?
space doesn't work :(
Rytz
Posts: 249
Joined: Wed Oct 25, 2006 6:05 am
Location: IL, USA
Contact:

Post by Rytz »

Elazul wrote:but then what's the button associated with jumping?
space doesn't work :(
You gotta set the key map array (or use the default) in Travis's above example. I haven't done this personally since I'm using a custom interface.
Image
Elazul
Posts: 38
Joined: Fri Mar 23, 2007 4:47 pm

Post by Elazul »

what is the default then?
Rytz
Posts: 249
Joined: Wed Oct 25, 2006 6:05 am
Location: IL, USA
Contact:

Post by Rytz »

Elazul wrote:what is the default then?
Look up addCameraSceneNodeFPS() in the documentation. It has a keymap example.
Image
Elazul
Posts: 38
Joined: Fri Mar 23, 2007 4:47 pm

Post by Elazul »

if you mean the api, i've been looking for hours, can't find anything useful , mind linking it?

i maybe overworked and that's why i may have overlooked something, but i'm not a forum noob, i usually do a search before i ask any questions, and only ask questions when i can't find anything.
much faster to find something myself than to wait for someone to respond to my question :D

thanks in advance though.
omar shaaban
Posts: 616
Joined: Wed Nov 01, 2006 6:26 pm
Location: Cairo,Egypt
Contact:

Post by omar shaaban »

jump doesnt work!!?
well u have to read this movement and if u read it u should be able to move your nodes and make the jump key and whatever....
Elazul
Posts: 38
Joined: Fri Mar 23, 2007 4:47 pm

Post by Elazul »

my friend, i am well beyond the point of reading the first tutorial... i've looked through it again in case there's something i overlooked, but i meant making a fps camera jump, not a model jump.
omar shaaban
Posts: 616
Joined: Wed Nov 01, 2006 6:26 pm
Location: Cairo,Egypt
Contact:

Post by omar shaaban »

ok so if u read it so the camera jump will be like that

if spacebar is pressed lets say jump=true

Code: Select all

while(cpos.y<20&&jump==true)
{
cpos.y+=1;
camera->setpostion(cpos);
}
if (cpos.y>=20)
{
jumb==false;
}

while(cpos.y>0&&jump==false)
{
cpos.y-=1;
camera->setpostion(cpos);
}
u could find many syntax error in this code i just showing u my idea :wink:
Elazul
Posts: 38
Joined: Fri Mar 23, 2007 4:47 pm

Post by Elazul »

thanks for the reply, but can you tell me what variable type cpos is initilized as?

and should that code (or what's similar to it) be inside the event handler itself , or the jump=true part be inside the handler, and the rest inside the draw loop itself?

(just incase this makes a difference, im using irrlicht 1.3 , not 1.3.1)
omar shaaban
Posts: 616
Joined: Wed Nov 01, 2006 6:26 pm
Location: Cairo,Egypt
Contact:

Post by omar shaaban »

Elazul wrote:thanks for the reply, but can you tell me what variable type cpos is initilized as?

and should that code (or what's similar to it) be inside the event handler itself , or the jump=true part be inside the handler, and the rest inside the draw loop itself?

(just incase this makes a difference, im using irrlicht 1.3 , not 1.3.1)
Well cpos stands for the camera postion so it will be like that:

Code: Select all

vector3df * cpos=camera->getPostion();
And jumb==true will be inside the handler when u press "space"
and the rest of the code as u said will be in the loop so it updates frequently
Post Reply