Here is a simple method for collisions / gravity

Blitz3D Forums/Blitz3D Beginners Area/Here is a simple method for collisions / gravity

Matty(Posted 2008) [#1]
Hello.
I've noticed that a number of people seem to have questions about things like 'jumping' 'collisions' and 'gravity' in recent times, so thought that I might try to post something a little constructive/helpful about the matter.

In the code shown below I have commented each line to attempt to explain what is happening at each stage of the program. In the program, the player is able to walk around a 3d environment, mouse look, walk up stairs, fall off ledges, and jump.

This is not necessarily the best way of doing this, and it is far from the only way of doing this but you may find it useful.

Feel free to use the code in any way you want and/or reuse it in your own projects.

The media is found at this web address (<1 MB)

http://home.swiftdsl.com.au/%7ETmalcolm/Tutorial/Environment.zip

It contains a single 3d model and really basic texture which you are free to use as you wish as well.

Here is the sourcecode, fully commented:



from Matt


sigi(Posted 2008) [#2]
Cool, thank you.


ervin(Posted 2008) [#3]
Excellent. This will come in very handy.
Thankyou.


chrisnorris007(Posted 2008) [#4]
i need this zip file as the link is now broken


fox95871(Posted 2009) [#5]
I too would like to request that.


Matty(Posted 2009) [#6]
Just replace the loadanimmesh("env....x") with another level mesh you may have created, there's nothing special about it. In fact you could use my free sci fi content pack and put something together and do it that way:

http://home.people.net.au/%7Etmalcolm/contentpack/mypage.html


Sph!nx(Posted 2009) [#7]
Hey thanks. I need to tweak my collision code, so I will take a look at this! First I need to figure out my entity code....


fox95871(Posted 2009) [#8]
Yeah, I noticed that after I got home and ended up doing just that. Oh well, at least I moved your thread up a bit!

Tweak your collision code... I wish that was all mine needed!


Nike(Posted 2009) [#9]
Hey Matty, i downloaded your scifi thing and it gave me the blue screen of death. :( Good thing i saved my program before i ran it!. Do you think you could try to fix it so it wont give me blue screen again?


Matty(Posted 2009) [#10]
Hi Nike, I very much doubt it was the code that caused your blue screen of death.