3 questions about movement and collisions. *solved*

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.
Post Reply
DarksideX
Posts: 22
Joined: Wed Dec 10, 2008 7:42 am

3 questions about movement and collisions. *solved*

Post by DarksideX »

Hello.

I want to make a platformer and im having some trouble.

1. Is there a way to lock variable? For example i want the z variable to be constant 0 when i walk around. Something like vector3df(no change, no change, 0);

2. Is there a way to check if there is a wall in front of the player using the built in collision system? Like collision_check(x,y,z)

3. How do i adjust how far i can see? Because the scene is dissapearing within a certain distance.

Thank you.

-Ali
Last edited by DarksideX on Mon Dec 15, 2008 4:27 am, edited 1 time in total.
nathanf534
Posts: 199
Joined: Tue Dec 09, 2008 2:55 am

Post by nathanf534 »

I can answer #3 for you.
camera->setFarValue(value);
while(signatureEmpty){cout<<wittyComment();}
Dark_Kilauea
Posts: 368
Joined: Tue Aug 21, 2007 1:43 am
Location: The Middle of Nowhere

Post by Dark_Kilauea »

#1. You'll need to set the z to 0 every frame I'm afraid.

#2. Should be possible, check out getCollisionPoint() and other methods of the collision system.
rogerborg wrote:Every time someone learns to use a debugger, an angel gets their wings.
DarksideX
Posts: 22
Joined: Wed Dec 10, 2008 7:42 am

Post by DarksideX »

I can answer #3 for you.
camera->setFarValue(value);
Thanks.
#1. You'll need to set the z to 0 every frame I'm afraid.

#2. Should be possible, check out getCollisionPoint() and other methods of the collision system.
Il check out the second.
But how do i set the z to 0 every frame?

if i use vector3df(0,0,0) then i will be stuck on one spot? How can i set only ONE of the axes?

Thanks.

-Ali
Ion Dune
Posts: 453
Joined: Mon Nov 12, 2007 8:29 pm
Location: California, USA
Contact:

Post by Ion Dune »

How about:

Code: Select all

core::vector3df Pos = node->getPosition();
Pos.Z = 0;
node->setPosition( Pos );
Pakje
Posts: 11
Joined: Sun Sep 07, 2008 11:42 am

Post by Pakje »

just curious but what would happen if you use a const int?
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

I guess you don't use the FPS camera (as this would be improper for a 2d platformer), so you should have some code to set the new position based on the user input. Simply fix z to 0 at this point :idea: You do this with 'pos.Z=0' assuming your new position is hold in variable pos.
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Re: 3 questions about movement and collisions.

Post by Acki »

beside of all other posts:
DarksideX wrote:2. Is there a way to check if there is a wall in front of the player using the built in collision system? Like collision_check(x,y,z)
you can also do it like this:

Code: Select all

// lock the Y position
node->setPosition(node->getPosition() * vector3df(1.0, 0.0, 1.0));
DarksideX wrote:3. How do i adjust how far i can see? Because the scene is dissapearing within a certain distance.
you can also make the nodes (scene) smaller... ;)
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
DarksideX
Posts: 22
Joined: Wed Dec 10, 2008 7:42 am

Post by DarksideX »

Thanks alot guys.

I do not use fps camera. I simply set it to the players x and y-100, something like that.

First two questions solved now i just have to learn how to use getCollisionPoint(). Any hint or ideas what on how i use it? Like what parameters are needed and what they do? Or is there is there a page i can check on that?

Thanks-

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

Post by Acki »

DarksideX wrote:Or is there is there a page i can check on that?
I think the collision tutorial from the sdk is a good starting point and of course the API... ;)
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
Dark_Kilauea
Posts: 368
Joined: Tue Aug 21, 2007 1:43 am
Location: The Middle of Nowhere

Post by Dark_Kilauea »

rogerborg wrote:Every time someone learns to use a debugger, an angel gets their wings.
DarksideX
Posts: 22
Joined: Wed Dec 10, 2008 7:42 am

Post by DarksideX »

Dark_Kilauea you are my hero!

Thanks :)

-Ali
Post Reply