Posted: 28th Mar 2003 12:15
For those of you who didn't want to bother with figuring out code to walk on an .X model, here it is.

+ Code Snippet
autocam off
sync on
sync rate 0

`load our land object
load object "land.x",1

`make a player
make object cube 10,2
position object 10,100,0,100


do
set cursor 0,0
print "height:",height#

`player controls
if leftkey()=1 then yrotate object 10,wrapvalue(object angle y(10)-0.25)
if rightkey()=1 then yrotate object 10,wrapvalue(object angle y(10)+0.25)
if upkey()=1 then move object 10,0.1

`get player positions
px#=object position x(10)
pz#=object position z(10)

`calculate the height at player X & Z
height#=100001-intersect object(1,px#,100000,pz#,px#,-100000,pz#)
`put player at the new height
position object 10,px#,height#,pz#
`simple camera follow
set camera to follow px#,height#,pz#,object angle y(10),10,height#+2,2,0

sync
loop


I've also made the zip file that has the compiled EXE, model and source.
Get it here: 1.4MB
http://dakoren.home.attbi.com/XHeight.zip

-Kensupen
Posted: 28th Mar 2003 23:59
SWEET KENSUPEN! Thank you thank you, thankyouthankyouthankyou.
Posted: 29th Mar 2003 6:13
Thank you very much, you gave away what I have been trying to figure out for 3 weeks...I'm a newb bigtime.

Thanks again!!
Posted: 7th Apr 2003 3:52
Nice demo but how did you convert the .bmp to .x
Posted: 7th Apr 2003 16:14
A .bmp is a 2D image, A .x is a 3D object. You could texture your .x model with the bitmap, but if you have walls on it, then you might as well just texture "a limb" (say the base of your model) in whatever model editor you have, then where the bitmap has a wall, put a wall object there. Then make into one giant .x

That's the only thing I can make from your question

Hope it helps
RED GENERAL
Posted: 7th Apr 2003 21:30
Are limbs the same thing as Joints from MilkShape??
Posted: 12th Apr 2003 4:12
I used Milkshape to make the 3D heightmap from that bitmap, then used the colored one to texture it. There are 2 heightmap generators in Milkshape. They are a max of 60x60 and 64x64. So, if you wanted more detail, you have to make several and weld them together.

-Kensupen
Posted: 12th Apr 2003 15:51
How could you make so that, If the polygon was too steep it wouldn't go up it?

Thanks
Posted: 12th Apr 2003 16:02
Continued...
For example to make a wall.
Posted: 16th Apr 2003 6:42
I was using a code very similar to that to make my floor collision work for building (if player collides with my invisible .X box, then place player above box, or, the floor) I'm wondering, how could I change it to incorporate multiple levels, just change the 100000 amount to 3 or 1 or something, so it doesn't check so high and low? Also, would you happen to know a way to get polygon detection to work optimally? I have buildings in my outside world that I can walk through (and on, thanks to you). Thanks again!
Posted: 20th Apr 2003 0:41
This program wont work on DBC
Do i need a update or something??
Posted: 20th Apr 2003 5:26
This is for DBPro only. DBC doesn't have the Intersect Object Command.

As for not being able to walk up a hill that is too steep, you just have to use NEWXVALUE and NEWZVALUE to find a spot in front of where you are walking, get that height, and compare it to your current height. If it's too much of a difference, then don't allow movement. The better way to do this would be to use trig to figure out the angle of the hill and set a max allowed for movement.

-Kensupen
Posted: 27th Apr 2003 6:11
Thanx Kensupen. I ran into a curious issue, perhaps you can help a newbie once more. I imported your model and added a skywalk between 2 of the hills end then re-exported it. WhenI walk under the skywalk, my character jumps up to the skywalk instead of letting me walk under it.

The skywalk is about 3 character lengths above it, much like a real person walking under Street Light Signals (Red, Yellow, Green).

It thinks it should be on the geometry even though I was just walking under it.

Any ideas on how to fix this? It's tickling my feeble mind, yet I cannot leave it alone.

thanx again
Posted: 27th Apr 2003 6:41
Cool, Kensupen.
Is it possible to do something like this for DBC?
I don't have DBP yet.
Posted: 27th Apr 2003 8:40
cypher try and reduce the 10000 - 10000 to say 50
Posted: 27th Apr 2003 22:36
Indi, thanx for the feedback. Heres what I got. I have a floor, one ramp from the floor to the catwalk. The catwalk is 18 points above my characters head.

So the intersect detects + - need for the character to jump up, but when I go up the ramp, my character stops climbing at 17 points and drops me to the floor, not even getting to the catwalk;

height#=17-intersect object(2,px#,16,pz#,px#,-16,pz#)

So, no matter how far up the catwalk is, the code will not let it climb up the ramp if the catwalk is higher then the intersect starting #17.

Am I missing something obvious? Sorry for asking questions in a Code Snippet only forum.

tx
Posted: 28th Apr 2003 8:03
hehe your ok.

Maybe set a condition that when are in a zone where the bridge is it performs differently

or if u collide or come within a distance with the bridge it changes the height code variables.


This is the only advice I can give with a small amount of insight to the problem at hand.
Posted: 28th Apr 2003 9:03
Ok, here's what you'd have to do. Import my model and then make the bridge. Delete my model so that just the bridge is left, in the position where it was when the hills were there. Export just the bridge. Load both models. Make a new intersect object command to detect the bridge. The only way I can think of doing this is only do the second intersect command if you are at a certain height. (The height of the top of the bridge) That way, if you are going to walk under it, DBPro will not run the second command. If you are high enough then it will setect it. I might have a crack at this and post a new one. I think I might have deleted my old ZIP.

-Kensupen
Posted: 7th May 2003 2:30
Can you use this code to read from any .x terrain model as I have a few .x models saved from Bryce?
Posted: 7th May 2003 20:41


Is there a way to do this in DBC?