how do i place a guy 30 units above his position on.........

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
wREAKAILDRON
Posts: 38
Joined: Tue Aug 21, 2007 6:54 pm
Contact:

how do i place a guy 30 units above his position on.........

Post by wREAKAILDRON »

how do i place my guy 30 units above his position on an octree node? I can load my mesh into an octreenode, and i can use ellipsiod collision detection on it, but when i try and make my guy go up steep hills, the guy sometimes catches parts of the floor and has an anoying pause during movement. I can think back to original collision progrmaming how id fix this, and it can be done by having the guy hover off of the floor a few units before you move the guy over with the next frame of movement. how can i get a ray collision point between my character and the floor in my octreenode?

i used the code from the demo example, but the mouse sprite pointer wouldnt move along with my character, and stayed at one position on the ground as i left the vicinity.
________
Angelina jolie pictures
Last edited by wREAKAILDRON on Tue Feb 22, 2011 6:52 am, edited 1 time in total.
arras
Posts: 1622
Joined: Mon Apr 05, 2004 8:35 am
Location: Slovakia
Contact:

Post by arras »

Suppose you have found correct spot on terrain, at the end of each movement do:

Code: Select all

guy->setPosition(  guy->getPosition() + vector3df(0,30,0) );
wREAKAILDRON
Posts: 38
Joined: Tue Aug 21, 2007 6:54 pm
Contact:

Post by wREAKAILDRON »

i want to see the code that reveals the spot on the ground underneath me in the firstplace.
________
Bmw m12
Last edited by wREAKAILDRON on Tue Feb 22, 2011 6:52 am, edited 1 time in total.
christianclavet
Posts: 1638
Joined: Mon Apr 30, 2007 3:24 am
Location: Montreal, CANADA
Contact:

Post by christianclavet »

I think for the "pause" your ellipsoid is probably too small for the terrain. If your ellipsoid was wide (as wide as your character with it's legs stretched), it could move it the way you want... I'd suggest that you tweak your collision elipsoid some more.

Perhaps, you could move your ellipsoid (I use this to simulate a "crouch" on my FPS Camera) using

Code: Select all

virtual void  setEllipsoidTranslation (const core::vector3df &translation)=0 
Also this could help you, check theses codes iin the SDK: (Also Example 7 as some collision intersection test in it)

Code: Select all

virtual bool  getCollisionPoint (const core::line3d< f32 > &ray, ITriangleSelector *selector, core::vector3df &outCollisionPoint, core::triangle3df &outTriangle)=0 
virtual core::vector3df  getCollisionResultPosition (ITriangleSelector *selector, const core::vector3df &ellipsoidPosition, const core::vector3df &ellipsoidRadius, const core::vector3df &ellipsoidDirectionAndSpeed, core::triangle3df &triout, bool &outFalling, f32 slidingSpeed=0.0005f, const core::vector3df &gravityDirectionAndSpeed=core::vector3df(0.0f, 0.0f, 0.0f))=0 
wREAKAILDRON
Posts: 38
Joined: Tue Aug 21, 2007 6:54 pm
Contact:

Post by wREAKAILDRON »

i think you may have gave me what i need, but i want my guys to hover and glide and not walk on the ground, i want my guys to fly over the ground a bit.
________
NASH RAMBLER SPECIFICATIONS
Last edited by wREAKAILDRON on Tue Feb 22, 2011 6:52 am, edited 1 time in total.
BlindSide
Admin
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

Post by BlindSide »

Yes, so you add a vertical value to the ellipsoid translation and your done.
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
wREAKAILDRON
Posts: 38
Joined: Tue Aug 21, 2007 6:54 pm
Contact:

Post by wREAKAILDRON »

i finnaly got the triangle selector method from the castle demo to work, but when i place my guy 10 units above the intersection point, my guy wobbles horribly up and down at a sonic rate i think because of the gravity applied with the ellepisoid collision detection. :D
________
MARIJUANA VAPORIZERS
Last edited by wREAKAILDRON on Tue Feb 22, 2011 6:52 am, edited 1 time in total.
christianclavet
Posts: 1638
Joined: Mon Apr 30, 2007 3:24 am
Location: Montreal, CANADA
Contact:

Post by christianclavet »

Change the position of the ellipsoid translation. Also, try to lower the gravity. Sometime it could be caused by a too great value.
wREAKAILDRON
Posts: 38
Joined: Tue Aug 21, 2007 6:54 pm
Contact:

Post by wREAKAILDRON »

i had the gravity down to 0,-1,0, and i got the worlbling, the only way i can make my guy hover over the ground, without the up and down jarring, at so many units above the ground is to loose the biult-in irrlicht gravity ( (0,0,0) gravity )

and i played with the translation a bit and that didnt help as well, i guess ill have to do my own gravity. :D
________
Drug Testing
Last edited by wREAKAILDRON on Tue Feb 22, 2011 6:52 am, edited 1 time in total.
wREAKAILDRON
Posts: 38
Joined: Tue Aug 21, 2007 6:54 pm
Contact:

Post by wREAKAILDRON »

how would i remove and set the gravity on an ISceneNodeAnimator node? :D
________
Alaska Medical Marijuana
Last edited by wREAKAILDRON on Tue Feb 22, 2011 6:53 am, edited 1 time in total.
christianclavet
Posts: 1638
Joined: Mon Apr 30, 2007 3:24 am
Location: Montreal, CANADA
Contact:

Post by christianclavet »

Another thing is that could could change the Origin in your model. But that could affect where you would want your character to pivot.
wREAKAILDRON
Posts: 38
Joined: Tue Aug 21, 2007 6:54 pm
Contact:

Post by wREAKAILDRON »

i can make the guy hover nicely by not having any gravity on my ellipsoid collision detection, now i want to know how to add and take away the gravity of an ISceneNodeAnimator instance. :D
________
Hot Box Vaporizers
Post Reply