Data Realms Fan Forums
http://45.55.195.193/

Wierd thing on position and the map seam
http://45.55.195.193/viewtopic.php?f=73&t=18608
Page 1 of 1

Author:  CaveCricket48 [ Mon Apr 26, 2010 8:39 pm ]
Post subject:  Wierd thing on position and the map seam

While I was working on my grappling gun, I discovered an interesting thing about the map seam and positioning on the map. If you use Lua to place an actor outside the range of the map (and the map is wrapping) and if the actor is controlled, the screen will go around the map and to that position, as if there is no wrapping. What I'm thinking (but I don't have enough tests to prove) is that the actor is technicly out-of-bounds, but physics are normal and its position is fixed an instant after. A way that I figured to get around this:

Code:
         self.pointer = <object>;
         self.movetopos = Vector(0,0);
   if SceneMan.SceneWrapsX == true then
       if self.movetopos.X > SceneMan.SceneWidth then
         self.pointer.Pos = Vector(self.movetopos.X - SceneMan.SceneWidth,self.movetopos.Y);
       elseif self.movetopos.X < 0 then
         self.pointer.Pos = Vector(SceneMan.SceneWidth + self.movetopos.X,self.movetopos.Y);
       else
         self.pointer.Pos = self.movetopos;
       end
   else
         self.pointer.Pos = self.movetopos;
   end


What this does is that the desired new position for the object is put in, the Lua automticly checks if the map wraps and the position is out-of-bounds, and to manually wrap it if so. What I'm wondering is why something like this isn't already in place in CC's engine to prevent screen problems.

Author:  TheLastBanana [ Tue Apr 27, 2010 1:14 am ]
Post subject:  Re: Wierd thing on position and the map seam

It does have this in place, but it only occurs within the engine updates as far as I know. That means that if you're using Lua to change an object's position, it doesn't fix it until next frame.

Author:  CaveCricket48 [ Tue Apr 27, 2010 1:18 am ]
Post subject:  Re: Wierd thing on position and the map seam

That makes sense. Is it one of the things that will to be changed next build?

Author:  TheLastBanana [ Tue Apr 27, 2010 1:21 am ]
Post subject:  Re: Wierd thing on position and the map seam

Well, the engine updates occur before the Lua updates, and I highly doubt it's going to change. It's just one of those things you'll have to take care of by yourself.

Author:  CaveCricket48 [ Tue Apr 27, 2010 1:27 am ]
Post subject:  Re: Wierd thing on position and the map seam

Okay, thanks for the info.

Page 1 of 1 All times are UTC [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/