#Stick on a surface head down

6 messages · Page 1 of 1 (latest)

green trench
#

Hello! Let's say I've got an ant on a rock, I would like the ant to be able to walk all around the rock surface : gravity is not the good way to make it, because it has to stick to the rock even with the head down.
If somebody has an idea of how to fix it, or a direction to point for help I would be grateful, preferably using octree and capsules. TY

raw roost
#

You can potentially have the rock itself (or someplace in the middle of the rock) apply an attractive force to the ant, but a better way is probably to move the ant's foot position along the object. If your object is a polygon mesh, then you can keep track of a 'forward' vector and change it as you go from polygon to polygon.

green trench
#

thank you @raw roost
I have to precise my mission, I spoke about a rock but it could also be a tree..., in fact it will be an external model so no easy geometry predetermined

The ant has a velocity ok

Could you explain a bit more about this : If your object is a polygon mesh, then you can keep track of a 'forward' vector and change it as you go from polygon to polygon.
You mean if the ant goes from a rock to the tree for exemple.

raw roost
#

I mean as the ant goes along the surface of the rock, or along the surface of the tree. Imagine that you're 'standing' on one polygon; you have a forward direction that's parallel to the plane of that polygon. You can follow that line until you get to the edge of the polygon, where there'll be another polygon — and then you just have to 'tip' your forward direction until it's parallel to the plane of the next polygon.

green trench
#

ok I understand the idea, I'll try to figure it out and apply. Thank you

raw roost
#

You're welcome!