Sign in to follow this  
Nuclear Taco

Extremely Simple AI Question

Recommended Posts

Nuclear Taco    102
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 - y[sub]1 [/sub]= m(x - x[sub]1[/sub])] 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.

Share this post


Link to post
Share on other sites
Cornstalks    7030
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 [url="http://www.gamasutra.com/resource_guide/20030121/jacobson_01.shtml"]Advanced Character Physics[/url] has a section [url="http://www.gamasutra.com/resource_guide/20030121/jacobson_02.shtml"]here[/url] 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 [url="http://www.gamedev.net/topic/617206-simulating-hair-physics/page__view__findpost__p__4896008"]here[/url]).

Share this post


Link to post
Share on other sites
Nuclear Taco    102
[quote name='Cornstalks' timestamp='1329977097' post='4915788']
-snip-
[/quote]
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!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this