Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Studio Chat / [SOLVED] Raycast 2d problem

Author
Message
Vinurd
1
Years of Service
User Offline
Joined: 25th Aug 2022
Location:
Posted: 2nd Sep 2022 20:06 Edited at: 2nd Sep 2022 20:28
This post has been marked by the post author as the answer.



project: https://kiberin.ru/test5.zip

the problem is that without shifting the level, the rays are drawn accurately and identify objects.



The screenshots show what to turn off to check that without shifting the camera. Rays and lines work. As soon as I turn it on SetViewOffset(camerax,cameray), the lines continue to work, and the rays stop.

Attachments

Login to view attachments

The author of this post has marked a post as an answer.

Go to answer

Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 2nd Sep 2022 20:33 Edited at: 2nd Sep 2022 20:43
i fixed the YT vid link. Edit the post to view the proper code to use, there.

otherwise, my hunch is that you're using screen coordinates somewhere vs world coordinates. see ScreenToWorldX/Y() concerning the use of SetViewOffset().

Draw is going to work as expected but your Ray, for example, needs World Coordinates to be accurate.

i only briefly skimmed your code and i do see:

and still feel your using World Coords where proper will resolve the issue.
Vinurd
1
Years of Service
User Offline
Joined: 25th Aug 2022
Location:
Posted: 2nd Sep 2022 20:50
everything seems to be configured correctly. I draw a line for display. And the beam should work along the same line. But it doesn't work
Vinurd
1
Years of Service
User Offline
Joined: 25th Aug 2022
Location:
Posted: 2nd Sep 2022 21:01
thank you! works

Login to post a reply

Server time is: 2024-03-29 01:47:33
Your offset time is: 2024-03-29 01:47:33