# Interactive objects

Hi,

I just rushed into a small problem.

Scenario:

Take this example: I have my terrain and want a bridge over the water. With the current boundings system i can detect hits, but i want to move over the bridge with my object.

Solution:

This same "problem" is solved in the terrainsystem to get the height of the terrain at a certain x,z value. I basically want to do the same with my bridge.

Since my kwowledge about the basics of the system are pretty…average, I wanted to ask how you guys would implement this kind of functionality.

What i have at this point: A object ( bow-like bridge with different heights), and my location in the world. Steps to take are: get my world location. Convert this to my location on the object (x,z values are the only ones that are important) then retrieve the height, based on these locations.

Cheers

You can cast a ray down and use the collation to get the height.

It is still in the cvs archives if you want it. He removed it because you could just do what I said with grater speed.

what I think marius is saying that the terrain is a different mesh than the bridge. You will most definetly need the trimesh follower algorithm (not the actual class tho)that cep has created. However, the bigger problem is how will you stop following one mesh and go onto another? Thats where badmi’s solution comes into play: cast a ray straight down and see the object that you have collided with.

Now if that was me, i would obtain a modified entity (from the AISystem using its ray collision methods) which gives you the Y value at a corresponding X,Z value through the terrain follower algorithm.

That would be my solution to the problem, it might not be the fastest/greatest solution to the problem, but I think its the most clear.

DP

There is triangle level collision now, you can get the triangle of the bridge that you are walking on and find that plane, as well as the normal for slope etc.

Don’t look at the bridge TriMesh which could have thousands of triangles. Instead, just find some generic approximation technique and test with that. If you want it exactly, look for my terrain following program somewhere in the CVS. It’s basicly exactly what you’re looking for.

Thanks all, I think i have enough information now!

"DarkProphet" wrote:
You will most definetly need the trimesh follower algorithm

What is wrong with using rays?

Nothing, i actually have to combine these two methodes. First cast a ray to find out if I collide with "something", then create a follower using that object.

Until now, everything works as planned.