Interacting With the world while moving...

Blitz3D Forums/Blitz3D Beginners Area/Interacting With the world while moving...

IKG(Posted 2006) [#1]
I've been able to get an object/person moving along the x, y, and z cordinates of the world by moving them as an entity. Now I want my object/person to be able to run up terrain and other objects which are set up with collisions.

For example, if I make a bug/insect, I would only be able to move it along the ground because that's all I know how to do right now. I want to learn how to make it so that my bug/insect will crawl up trees and rocks whenever it randomly walks into one.

Thanks :)


WolRon(Posted 2006) [#2]
Your question is open-ended.

First, do you know how to set up Collisions in Blitz?
If you look at my First Person Shooter (FPS) example on my website, it might help.
http://home.cmit.net/rwolbeck/programmingtutorial

http://www.blitzbasic.com/Community/posts.php?topic=54433&hl=collisions

http://www.blitzbasic.com/Community/posts.php?topic=54794&hl=collisions


IKG(Posted 2006) [#3]
Yes, I do. I just want to create a spider-type effect with a bug, so I can make it crawl up anything it bumps into.


Ross C(Posted 2006) [#4]
I think you want to align your spider to any geometry it touches?


WolRon(Posted 2006) [#5]
To do as Ross asked, perform a Linepick 'downward' from your ant, then use the PickedNX, Y, and Z values to determine how to orientate your ant.

If you don't know what normals are, tnen ask.


IKG(Posted 2006) [#6]
Please explain how to do this WolRon. I'm sort of a beginner at B3D. Thank you very much :)


WolRon(Posted 2006) [#7]
I just did :0

Here's one example:
http://www.blitzbasic.com/Community/posts.php?topic=52532&hl=Linepick

Normals:
http://www.blitzbasic.com/Community/posts.php?topic=48948&hl=normals

more linepick explanations:
http://www.blitzbasic.com/Community/posts.php?topic=45694&hl=normals


IKG(Posted 2006) [#8]
Oh lol sorry. I meant the "linepick" part. Could someone please explain to me how "linepicks" work and what they are?


Ross C(Posted 2006) [#9]
Look up the linepick command and the pickedNX PickedNY and PickedNZ. Do a linepick from the players current XYZ position (EntityX(), EntityY() and EntityZ()). Choose a length for your linepick. Perform the linepick. Use the AlignToVector command:

AlignToVector mesh,PickedNX(),PickedNY(), PickedNZ()


Do this every loop and that should be you sorted.


IKG(Posted 2006) [#10]
But how would I do this randomly? I want this bug to move around the world randomly, just like I got my person to do.

Won't I have to manually choose where to align the entity each move?


WolRon(Posted 2006) [#11]
Won't I have to manually choose where to align the entity each move?
Yes


IKG(Posted 2006) [#12]
Well there must be a way to have a spider wander around a house or forest. Linepicking is the only way you think it'll work?


WolRon(Posted 2006) [#13]
What are you asking for? Try to be more specific.

Are you asking for how to perform pathfinding?


IKG(Posted 2006) [#14]
Ok, here's an example scenario. There is a random spider placed in a map. It crawls around randomly in any direction. If it runs into a wall and still wants to move forward, it will begin crawling up the wall just like in real life. From there on it just continues moving in whichever direction it wants.

As of now, I can get an object or person to move around randomly, but not interact with collisions and climb up walls or trees like spiders do.


WolRon(Posted 2006) [#15]
I believe we pretty much explained it. Start typing some code, and see what happens. The answers may come to you.

Did you even read all of the links I gave you?


IKG(Posted 2006) [#16]
I don't know how I missed that post of yours. Thanks a lot WolRon; I'll read them right now.


IKG(Posted 2006) [#17]
Sorry to bump such an old topic, but I just found another example of what I'm trying to do.



This is from BlitzTree. It generates grass and trees randomly across terrain. Was this also done with linepicks? I'm guessing yes.


octothorpe(Posted 2006) [#18]
Funny, I don't see any spiders in that picture.

Perhaps the author is using LinePicks to determine at what height to place trees and greenery? I fail to see what this has to do with a spider roaming around.


Stevie G(Posted 2006) [#19]
Someone did a snake thing crawling over scenery based on collision normals. Check the code archives you should find it there.

[EDIT ] Here it is ....
http://www.blitzbasic.com/codearcs/codearcs.php?code=1069

Stevie


IKG(Posted 2006) [#20]
It has nothing to do with spiders. I was just showing how it places trees and grass all over hills like that (randomly). As opposed to having to place them down manually. Don't know if I can explain it, but I'm guessing it's linepicks.


n8r2k(Posted 2006) [#21]
Are you asking if they used linepicks to realistically place trees and shrubs and crap all over the hill randomley but also realisticly like octothorpe suggested earlier?


IKG(Posted 2006) [#22]
Yes!