Difference between revisions of "Determining Ground Position"
imported>DragoonWraith (keep this) |
imported>8asrun6aer m |
||
(4 intermediate revisions by the same user not shown) | |||
Line 13: | Line 13: | ||
For levitate spells I do something very similar. If you set the z coord and then next frame get the new z coord, if it is the same (or higher) you have hit the ground. You can detect explosive wall collisons in a similar manner but this is harder. -- Guidobot | For levitate spells I do something very similar. If you set the z coord and then next frame get the new z coord, if it is the same (or higher) you have hit the ground. You can detect explosive wall collisons in a similar manner but this is harder. -- Guidobot | ||
: To see if an ''Actor'' has hit the ground yet, you can check its [[IsOnGround]] or [[IsInAir]] flags on each frame. [[IsSwimming]] is also a good one to check if the actor hit water. See those pages for any prerequisites. Generally, it looks like just an [[IsInAir]] check would suffice to check if an actor is still floating or falling and hasn't encountered the ground yet. [[IsInAir]] works well with [[SetPos]] assuming your actor isn't moving too fast. --[[User:8asrun6aer|8asrun6aer]] 2012-12-21 | |||
How do you spawn items in game which fall to the ground with havok? (Off topic: how do you additem in the console: it always says that it can't find the object id i type) --Sykotik | How do you spawn items in game which fall to the ground with havok? (Off topic: how do you additem in the console: it always says that it can't find the object id i type) --Sykotik | ||
Line 20: | Line 21: | ||
This question has been answered by [[User:JustTim|JustTim]] above.--[[User:Omzy|Omzy]] 21:26, 2 June 2007 (EDT) | This question has been answered by [[User:JustTim|JustTim]] above.--[[User:Omzy|Omzy]] 21:26, 2 June 2007 (EDT) | ||
[[Category:Solutions]] | [[Category:Solutions]] |
Latest revision as of 00:35, 22 December 2011
This article is actually a discussion which was brought into the Main Wiki because it has interesting or important information. It should be converted into an actual article; if you can do this, it would be appreciated.
I'm looking for a way to determine the z position of the ground at a given (x,y) location. I was thinking maybe spawning some object that would fall to the ground due to gravity, but how would you know how high to spawn it? And then it would take time to fall as well. --MrFlippy
Even if you spawn it VERY high, it may collide with another object long before hitting the ground (an house's roof, for example, or a tree...). And, as you said, it will not fall instantly... --Bifmadeinsabbioni
I tried to do this by using a spawned object too. it would work, but if you want to move the object on its x and y axis together with an other object it doesn't work anymore, since the physical z movement seems to be terminated when te object is moved by a script function. --JustTim 08:13, 9 May 2006 (EDT)
What function do you use? set pos or move to? I think that set pos shouldn't terminate z axis movement --Bifmadeinsabbioni
i'm using setpos. it's a very weird problem. if you use setpos each frame on the object the physics don't seem to apply, even if you don't modify all axes. it sometimes ends up completely unmoveable even if you stop using setpos. --JustTim 11:12, 9 May 2006 (EDT)
i've found a way: Move an actor into the floor, wait one frame and check his z coordinate afterwards. it works. --JustTim 14:10, 10 May 2006 (EDT)
For levitate spells I do something very similar. If you set the z coord and then next frame get the new z coord, if it is the same (or higher) you have hit the ground. You can detect explosive wall collisons in a similar manner but this is harder. -- Guidobot
- To see if an Actor has hit the ground yet, you can check its IsOnGround or IsInAir flags on each frame. IsSwimming is also a good one to check if the actor hit water. See those pages for any prerequisites. Generally, it looks like just an IsInAir check would suffice to check if an actor is still floating or falling and hasn't encountered the ground yet. IsInAir works well with SetPos assuming your actor isn't moving too fast. --8asrun6aer 2012-12-21
How do you spawn items in game which fall to the ground with havok? (Off topic: how do you additem in the console: it always says that it can't find the object id i type) --Sykotik
- (Off topic answer: the item name to use in the console is not eg. "FPtestNPC" but a sequence of character. You can see this in CS is the 2nd column (it's between ID and Name). I'm not really sure but i remember this.)
- -- Tesfabpel
This question has been answered by JustTim above.--Omzy 21:26, 2 June 2007 (EDT)