monoray Registered User |
Quote
|
2017-03-23 21:20:06 |
|
For my third person game, I would like enemies to run at you when they get close enough, and when they get super close they attack. Simple enough right? the only problem is whenever I do "set position of scene node (enemy) to (player), the enemy clips through terrain and objects. Is there a way to avoid this? (I tried using the included enemy behavior but it just doesn't cut it for the game I'm making)
|
monoray Registered User |
Quote
|
2017-03-25 03:17:17 |
|
I really need help with this, it feels like I've tried everything. I really wish there was a "walk towards (scene node) at (speed)" where the walking scene node collides with things and is effected by gravity.
|
just_in_case Moderator |
Quote
|
2017-03-25 04:41:17 |
|
Use collides when moved behaviour on your enemy scenenode... Then it will not be able to pass throug hother objects and terrains...
|
monoray Registered User |
Quote
|
2017-03-25 18:09:08 |
|
the "set position of scene node to scene node" behavior doesn't pay any attention to the collide behavior, I'm not using the preset enemy behavior that has them wander aimlessly and occasionally execute an action when you're close.
|
tim12345 Guest |
Quote
|
2017-03-25 19:18:07 |
|
i think your best bet is to use the javascript command for that. then it should detect collision.
var s = ccbGetSceneNodeFromName("enemy"); ccbAICommand(s, "moveto", new vector3d(0, 0, 0));
while it seems limited to a specific 3d position, perhaps you could use a variable to determine the position of the player.
|