Page 1 of 1

Moving IgeEntity responsively to the client viewport

PostPosted: Fri Oct 25, 2013 6:14 pm
by lucbr
Hi!

I would like to move one IgeEntity from the left-side of the client screen to its right-side, and vice versa. However, I need to take into account that the client screen can be different.

One behavior like that could be achieved by using the left or right attribute from IgeUiEntity. However, I would like to know how to do that by using my custom class extended from IgeEntity.

I really need to know the client viewport on my server-side to translate my IgeEntity properly.

Thank you!! :)

Re: Moving IgeEntity responsively to the client viewport

PostPosted: Sat Oct 26, 2013 12:18 am
by rob
Is there only going to be one client connected? If not then I don't know how the server could move the object for each different client's screen size...

Are you sure that you want to do it that way anyway? The server doesn't (and shouldn't) know anything about the rendering details on the client. It is up to the client to scale the simulation to fit the screen.

If you are looking to have the same "bounds" on each client so that regardless of the screen resolution you always have 800 world pixels from left to right then you can just calculate the correct scale ratio and scale the viewport camera so that all clients see the same view, just some will see it "bigger" if their resolution is high.

Hope that makes sense!

Re: Moving IgeEntity responsively to the client viewport

PostPosted: Sat Oct 26, 2013 12:23 am
by lucbr
yeah, it makes sense :) Thanks!