Interacting With the world while moving...
Blitz3D Forums/Blitz3D Beginners Area/Interacting With the world while moving...
| ||
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 :) |
| ||
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 |
| ||
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. |
| ||
I think you want to align your spider to any geometry it touches? |
| ||
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. |
| ||
Please explain how to do this WolRon. I'm sort of a beginner at B3D. Thank you very much :) |
| ||
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 |
| ||
Oh lol sorry. I meant the "linepick" part. Could someone please explain to me how "linepicks" work and what they are? |
| ||
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. |
| ||
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? |
| ||
Won't I have to manually choose where to align the entity each move? Yes |
| ||
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? |
| ||
What are you asking for? Try to be more specific. Are you asking for how to perform pathfinding? |
| ||
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. |
| ||
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? |
| ||
I don't know how I missed that post of yours. Thanks a lot WolRon; I'll read them right now. |
| ||
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. |
| ||
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. |
| ||
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 |
| ||
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. |
| ||
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? |
| ||
Yes! |