About Store Forum Documentation Contact



Post Reply 
Question about Chr :: Bool actionMoveTo (C Vec &pos);
Author Message
Ozmodian Offline
Member

Post: #1
Question about Chr :: Bool actionMoveTo (C Vec &pos);
Hi All,

I have finally started playing around again and am stuck on something really stupid. I am using tutorial "14 - Game Basics --> 01 Character".

I have added the following class

Code:
class Enemy : Game.Chr
{
   virtual Bool update()
   {
      return super.update();
   }
}

Enemy enemy;

In init i did the following

Code:
enemy.create(*Game.Objs(UID(2919624831, 1261075521, 753053852, 3651670215))); // create player from object parameters

   enemy.pos(Vec(-3, 0,-3));
  
   // THIS WORKS FINE (Uncomment out to see)
   //enemy.actionMoveDir(Vec(0, 0, 0));
  
   // THIS ONE NEVER DOES ANYTHING
   enemy.actionMoveTo(Vec(0, 0, 0));

I of course added the update call and the drawPrepare call as well so it works, it is just I don't understand how actionMoveTo [/quote]works if you don't have an area and therefor a PathMesh. Can actionMoveTo be used without an Area?

For ease, i have also attached the whole main in a .txt


Attached File(s)
.txt  Issue with actionMoveTo.txt (Size: 4.19 KB / Downloads: 6)
01-13-2015 05:10 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: Question about Chr :: Bool actionMoveTo (C Vec &pos);
Hello,

I haven't checked your code, but perhaps in Init the world is not loaded yet?
Game.World.update loads the actual world data.
01-14-2015 09:50 PM
Find all posts by this user Quote this message in a reply
Ozmodian Offline
Member

Post: #3
RE: Question about Chr :: Bool actionMoveTo (C Vec &pos);
There is no game world. I know how to use the function with a world but not without
01-14-2015 11:04 PM
Find all posts by this user Quote this message in a reply
Zervox Offline
Member

Post: #4
RE: Question about Chr :: Bool actionMoveTo (C Vec &pos);
The function works by having a PathWorld, in which case it first gets the height of the terrain or the physics object it hits and uses that in the PathWorld to get the closest-to point which is pathable.
01-14-2015 11:27 PM
Find all posts by this user Quote this message in a reply
Ozmodian Offline
Member

Post: #5
RE: Question about Chr :: Bool actionMoveTo (C Vec &pos);
Hi Zervox,

Ahh ok. Sounds like it had no use without a world then. I am perfectly happy using move direction for now. Thanks for your clarification (I should get the source so I can see the inner workings of some of this stuff!!)
01-15-2015 09:43 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #6
RE: Question about Chr :: Bool actionMoveTo (C Vec &pos);
I do recommend getting the source smile

The Game.Chr operates on Game.World and Game.World.path by the way smile
01-15-2015 12:42 PM
Find all posts by this user Quote this message in a reply
Post Reply