View unanswered posts | View active topics It is currently Sat Jan 11, 2025 4:13 am



Reply to topic  [ 5 posts ] 
 Wierd thing on position and the map seam 
Author Message
User avatar

Joined: Tue Jun 12, 2007 11:52 pm
Posts: 13144
Location: Here
Reply with quote
Post 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.


Mon Apr 26, 2010 8:39 pm
Profile
DRL Developer
DRL Developer
User avatar

Joined: Wed Dec 13, 2006 5:27 am
Posts: 3138
Location: A little south and a lot west of Moscow
Reply with quote
Post 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.


Tue Apr 27, 2010 1:14 am
Profile WWW
User avatar

Joined: Tue Jun 12, 2007 11:52 pm
Posts: 13144
Location: Here
Reply with quote
Post 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?


Tue Apr 27, 2010 1:18 am
Profile
DRL Developer
DRL Developer
User avatar

Joined: Wed Dec 13, 2006 5:27 am
Posts: 3138
Location: A little south and a lot west of Moscow
Reply with quote
Post 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.


Tue Apr 27, 2010 1:21 am
Profile WWW
User avatar

Joined: Tue Jun 12, 2007 11:52 pm
Posts: 13144
Location: Here
Reply with quote
Post Re: Wierd thing on position and the map seam
Okay, thanks for the info.


Tue Apr 27, 2010 1:27 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 5 posts ] 

Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.050s | 14 Queries | GZIP : Off ]