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 Classic Chat / 2d raycast now working ?

Author
Message
haliop_New
User Banned
Posted: 23rd Nov 2014 04:54
im trying to use physicsRayCast(x,y,x1,y1)
but i dont know the math behind turning an angle and distance into X1,Y1
so what i did :

a fake bullet sprite , a simple long 1x500 and rotating towards the mouse positions it looks like the longest sword you have ever seen.
so once i have this and the right angle i can
GetWorldXfromSprite and GetWorldYfromSprite which will give the resulting x1,y1



however the raycast returns 0 no matter when i hit..
have someone already used it ?
or can share a code or some math ?

thank you for your time.
Markus
Valued Member
21
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 23rd Nov 2014 12:15
example with non physics means shape box or circle.
shape must be set



AGK 108 (B)19 + AppGameKit V2 Alpha .. : Windows 8.1 Pro 64 Bit : AMD Radeon R7 265 : Mac mini OS X 10.10 (Yosemite)
haliop_New
User Banned
Posted: 23rd Nov 2014 13:02
thank you but i got it working for physics with groups

PhysicsRayCastGroup(group,x,y,x1,y1)
just had to change the groups
it works great. thank you.

Login to post a reply

Server time is: 2025-05-23 18:47:16
Your offset time is: 2025-05-23 18:47:16