tzachshabtay / MonoAGS

AGS (Adventure Game Studio) reimagined in Mono
https://tzachshabtay.github.io/MonoAGS/
Artistic License 2.0
27 stars 8 forks source link

Get camera target position in absolute coordinates from a bounding box #268

Closed ghost closed 6 years ago

ghost commented 6 years ago

This makes AGSCamera to retrieve target object's position in absolute room coordinates as opposed to just using IObject.X and .Y that could be local coordinates relative to object's parent.

Known issues: I noticed that when going into scrolling room camera starts at position 0,0 during transition and switches to character only after transition ends. Perhaps hit box is not updated in time?

ghost commented 6 years ago

Hmm, wait... this is what IColliderComponent.CenterPoint's implementation already does. Why its use was disabled in AGSCamera?

tzachshabtay commented 6 years ago

I don't remember for sure, as it was from before the project was put on source control, but I think it didn't look as nice as targeting the pivot point on some occasions (which is probably why I also added that todo comment there to allow choice). I'll try to play around with the PR to see if something pops up (and also look at the room transition issue).

ghost commented 6 years ago

This solution still does not work with the render layers that has parallax speed. Actually, I am currently having troubles with parallax layers in my test game, trying to adjust object positions there, which made me very confused... not the best time to add more fixes.

tzachshabtay commented 6 years ago

Ok, so should I close this for now?

Regarding the parallax layer, some of the recent problems I had with it is because it's part of the viewport matrix and not the model matrix. I want to change that and put the parallax in the model matrix which, if I can get it to work, will probably make things work more consistent.

ghost commented 6 years ago

Ok, so should I close this for now?

Alright, I guess, since it does not target pivot point, and does not give a solution to calculate absolute coordinates of one.

I don't know what is preferred here. It seems my knowledge of the engine is not enough for this.

ghost commented 6 years ago

So, idk if this gets closed, opened an issue #270 to describe the problem itself.