Jump to content



Extremely Simple AI Question

  • You cannot reply to this topic
2 replies to this topic

#1 Nuclear Taco   Members   -  Reputation: 100

Like
0Likes
Like

Posted 22 February 2012 - 11:36 PM

I'm attempting to make a simple cube follow the player, but I haven't had much experience with the math part of this. If it matters I am using blitz3d, mainly for its extremely fast and easy development time. My partner and I have a few ideas on how this might work, just not how to implement them. We were thinking that
[y - y1 = m(x - x1)] Or something using the Pythagorean theorem. But after trying different things for a few times, and failing all of them we decided to ask for help.



Also, we are working with a (x,z) plane.

Ad:

#2 Cornstalks   Members   -  Reputation: 1217

Like
0Likes
Like

Posted 23 February 2012 - 12:04 AM

If you want the cube to be a constant distance from the player and to follow him/her wherever he/she goes, you can use a constraint. The paper Advanced Character Physics has a section here that talks about solving constraints by relaxation. You could apply the same concept here to restrict the cube to be a certain distance from the player, and it would naturally follow the player. I've used this method in a number of things and I've been happy with its results (I replied to another post and wrote some code that demonstrates this behavior which you can see here).
[ Realistic Rendering ] [ School + Dublin = Boom ] [ I've been ninja'd 70 times ] [ f.k.a. MikeTacular ] [ My Blog ]

#3 Nuclear Taco   Members   -  Reputation: 100

Like
0Likes
Like

Posted 23 February 2012 - 12:22 AM

View PostCornstalks, on 23 February 2012 - 12:04 AM, said:

-snip-
Ahh that actually makes sense. Now tomorrow I'll just have to convert it to BASIC stynax which won't be a problem. Then I'll just modify the code to suit my needs. Thank you!






We are working on generating results for this topic
PARTNERS