Ray casting

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
GundamO
Posts: 9
Joined: Thu Nov 11, 2010 11:34 am

Ray casting

Post by GundamO »

Hi guys,

i am attempting to cast a ray from my model downwards against the terrain to set the models height, only problem is that i am lost on how to write the actual ray, i know the start position of the ray will be the models position but i am not sure how to write the end of the ray.

i have already tried using the getheight function for updating the height but because i am creating a platformer with jumping, when i am on top of a platform it doesnt register that the height of the model is not the terrain but the terrain PLUS the height of the platform and thus my jumpin wont work, but i digress.

if any one could help me with how to write the end point on the ray. Thanks in advance for any help
ent1ty
Competition winner
Posts: 1106
Joined: Sun Nov 08, 2009 11:09 am

Post by ent1ty »

Code: Select all

vector3df end= start;
end.Y-= 9999;
Edit: I was first :lol: :P
Last edited by ent1ty on Wed Mar 02, 2011 10:45 am, edited 1 time in total.
irrRenderer 1.0
Height2Normal v. 2.1 - convert height maps to normal maps

Step back! I have a void pointer, and I'm not afraid to use it!
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post by CuteAlien »

Just subtract a real huge value from your y-axis of the startpoint to be sure it's large enough. If you know the the maximal size of your world you can use that value.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Post Reply