Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Code Snippets / Walking on an .X model

Author
Message
Kensupen
22
Years of Service
User Offline
Joined: 19th Sep 2002
Location: United States
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.



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
TogaMario
21
Years of Service
User Offline
Joined: 30th Jan 2003
Location:
Posted: 28th Mar 2003 23:59
SWEET KENSUPEN! Thank you thank you, thankyouthankyouthankyou.

P.S. This is what the alphabet would look like if Q and R were eliminated.
cypher
21
Years of Service
User Offline
Joined: 27th Nov 2002
Location:
Posted: 29th Mar 2003 06: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!!

Codger
22
Years of Service
User Offline
Joined: 23rd Nov 2002
Location:
Posted: 7th Apr 2003 03:52
Nice demo but how did you convert the .bmp to .x

Red general
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: United Kingdom
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

My computer melts regulary - perhaps it likes being fondue
KamaKase
22
Years of Service
User Offline
Joined: 29th Oct 2002
Location:
Posted: 7th Apr 2003 21:30
Are limbs the same thing as Joints from MilkShape??

Kensupen
22
Years of Service
User Offline
Joined: 19th Sep 2002
Location: United States
Posted: 12th Apr 2003 04: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
Oliver
22
Years of Service
User Offline
Joined: 24th Nov 2002
Location: Switzerland
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
Oliver
22
Years of Service
User Offline
Joined: 24th Nov 2002
Location: Switzerland
Posted: 12th Apr 2003 16:02
Continued...
For example to make a wall.
TogaMario
21
Years of Service
User Offline
Joined: 30th Jan 2003
Location:
Posted: 16th Apr 2003 06: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!

P.S. This is what the alphabet would look like if Q and R were eliminated.
AlphaOmega
21
Years of Service
User Offline
Joined: 19th Apr 2003
Location: Netherlands
Posted: 20th Apr 2003 00:41
This program wont work on DBC
Do i need a update or something??

Kensupen
22
Years of Service
User Offline
Joined: 19th Sep 2002
Location: United States
Posted: 20th Apr 2003 05: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
cypher
21
Years of Service
User Offline
Joined: 27th Nov 2002
Location:
Posted: 27th Apr 2003 06: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

Mr Underhill
21
Years of Service
User Offline
Joined: 23rd Apr 2003
Location: The Forgotten Worlds...
Posted: 27th Apr 2003 06:41
Cool, Kensupen.
Is it possible to do something like this for DBC?
I don't have DBP yet.

"not all that is gold does not glitter, not all those who wander are lost, not all that is old does not whither, deep roots are not reached by the frost..." - Aragorn (Strider)
indi
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 27th Apr 2003 08:40
cypher try and reduce the 10000 - 10000 to say 50

cypher
21
Years of Service
User Offline
Joined: 27th Nov 2002
Location:
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

indi
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 28th Apr 2003 08: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.

Kensupen
22
Years of Service
User Offline
Joined: 19th Sep 2002
Location: United States
Posted: 28th Apr 2003 09:03 Edited at: 28th Apr 2003 09:08
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
SpecTre1
21
Years of Service
User Offline
Joined: 24th Feb 2003
Location: United Kingdom
Posted: 7th May 2003 02:30
Can you use this code to read from any .x terrain model as I have a few .x models saved from Bryce?

New to DBPro comin from AMOS on the Amiga!
FiShFuN4eVeR
21
Years of Service
User Offline
Joined: 2nd Feb 2003
Location: Netherlands
Posted: 7th May 2003 20:41


Is there a way to do this in DBC?

If good programmer()=1 then print "Finaly I get to the top "
Conrad Brown
21
Years of Service
User Offline
Joined: 18th Apr 2003
Location:
Posted: 8th May 2003 05:01
Would it not be better to do the test from the player's y-value? That way, no matter how high or low the player is, the test should work (shouldn't it?)

Kensupen
22
Years of Service
User Offline
Joined: 19th Sep 2002
Location: United States
Posted: 13th May 2003 01:26
Right now, I'm working on using intersect object to make a psuedo BSP style sliding collision on any .X object/level/terrain. I have sliding box collision working, but I need it to slide at any angle. BSP support in DBPro sucks at this point. I also want to be able to have the same sliding collision as a BSP, except in an outdoor type setting. So, once I have this completed. I'm going to see if I can get it hosted for download here and on RGT. If it's good enough, I'll see if the DBS team will just make it into a command so BSPs can just be chucked. I might post for help on doing the physics. I know someone posted a DLL for .X Sliding collision, but it looks way too complicated. DBPro is supposed to be a BASIC language, so I'm aiming for an easier way to accomplish this.

-Kensupen
Kensupen
22
Years of Service
User Offline
Joined: 19th Sep 2002
Location: United States
Posted: 13th May 2003 01:32
Oh yeah. I forgot about the DBC issue.

The only way this would ever work in DBC is if someone made a DLL or other way(memblock, etc.) to detect the distance between two points and see if there is a polygon in that vector. This is way outta my range of programming. If someone invents that for DBC then this code could be slightly modified to do the same thing.

I attempted a generic way of doing this earlier, but it chewed up CPU and didn't work all that great. What I did was load an .X landscape and set it to polygon collision. Next I did a for loop to check from a certain height (Usually the top of the model) to a negative height with setting a sphere to those heights and then checking collision. It was slow.

I just use intersect object. One of the added features of DBPro.

-Kensupen
TogaMario
21
Years of Service
User Offline
Joined: 30th Jan 2003
Location:
Posted: 27th May 2003 21:55
Very interested in seeing how this plays out, please keep us "posted" Sliding Collision sucks in DBPro, so i'm looking all any manner of alternate means. Can't wait to see what comes out.

P.S. This is what the alphabet would look like if Q and R were eliminated.
LoKiDeCaT
22
Years of Service
User Offline
Joined: 28th Aug 2002
Location: United States
Posted: 28th May 2003 12:45
http://www.darkbasicpro.com/apollo/view.php?t=10315&b=6

That's how it played out so far, if at all interested.

Loki D'Cat - Modeller, Composer, Animator
Nerdsoft Creations
Machine Specs: Athlon XP1800+, ATi Radeon 8500 64mb, 1GB RAM, Windows 2000 AdvSvr
Eddie Gordo
21
Years of Service
User Offline
Joined: 14th Jan 2003
Location: Ohio - USA
Posted: 5th Jun 2003 01:00
hmm.. i used a matrix like .x model and this didnt work i used the


like the get matrix height command is there somthing missing

Artifact Basic-5%
Epic Crossings RPG-25%
Kensupen
22
Years of Service
User Offline
Joined: 19th Sep 2002
Location: United States
Posted: 5th Jun 2003 13:46
What was it doing/not doing? Just didn't work is a little vague. If you can give me more detail, I'll get it working for you.

-Kensupen

Nerdsoft Creations - Lead Programmer
System Specs: AMD XP 1700+, WinXP Home, 1GB PC133 ram and Radeon 9500 using DX9
Eddie Gordo
21
Years of Service
User Offline
Joined: 14th Jan 2003
Location: Ohio - USA
Posted: 5th Jun 2003 21:36
well its a matrix-like object like i said but it wouldnt give me the height it just kept it at 1 height and didnt change like it wasnt getting height, and the object number is supposed to be the number of the matrix object right

Artifact Basic-5%
Epic Crossings RPG-25%
Kensupen
22
Years of Service
User Offline
Joined: 19th Sep 2002
Location: United States
Posted: 7th Jun 2003 02:42
That code I posted only checks against object number 1. If your model isn't object number one, then it won't return any values. You can do one of two things if it isn't.

1. Change the number in the intersect object(1,blah,blah) to the number of your model.
2. Load the model as #1

If that's not the problem, re-post and I'll help you sort it out.

-Kensupen

Nerdsoft Creations - Lead Programmer
System Specs: AMD XP 1700+, WinXP Home, 1GB PC133 ram and Radeon 9500 using DX9

Login to post a reply

Server time is: 2024-11-24 05:06:01
Your offset time is: 2024-11-24 05:06:01