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 / SetSpriteShapeBox() / AddSpriteShapeBox(() inquiry

Author
Message
lilpissywilly
AGK Developer
14
Years of Service
User Offline
Joined: 10th Sep 2010
Location: Office Chair
Posted: 26th Nov 2012 20:03 Edited at: 26th Nov 2012 20:04
I have a question about how the angle in this function is supposed to .. function?

I usually end up setting all sorts of different numbers to get the angle of the box I desire. I've tried using 0.xxx values but these make no sense either. Also tried with radians to angle calculations.

Also setting the angle moves the shape to all sorts of weird places so what I always end up having to do is, do physicsDebugOn and retry until I find the angle I want, then move the offset of the shape until it's where I want it.

Practically:



^ Ends up looking like the screenshot provided, with the shapes in respective order.



My hovercraft is full of eels

Attachments

Login to view attachments
AgentSam
12
Years of Service
User Offline
Joined: 14th Mar 2012
Location: Virtual Space
Posted: 27th Nov 2012 14:53 Edited at: 27th Nov 2012 14:54
Quote: "addSpriteShapeBox(sprite2, 0, 0, 100, 10, radToDegrees(90))"


Shouldn't this be "DegreeToRad(90)", instead...

Also same for the other addSpriteShapeBox, where you use a plain angle.

You can use this function to convert:

lilpissywilly
AGK Developer
14
Years of Service
User Offline
Joined: 10th Sep 2010
Location: Office Chair
Posted: 27th Nov 2012 17:22
Yes that is correct I typed it out wrong, but I've done that too and that leaves the boxes aligned no matter the degree I send to the conversion is. So I don't think it calls for radians either. Only our lord(s) knows.

My hovercraft is full of eels
Jogimus
12
Years of Service
User Offline
Joined: 10th Nov 2012
Location:
Posted: 27th Nov 2012 17:50 Edited at: 27th Nov 2012 17:50
It is radians, Pi/2.0 gives you 90 degree rotation, Pi = 180 degrees and 2*Pi = 360 degrees. I just tested your example and rotations are correct.
lilpissywilly
AGK Developer
14
Years of Service
User Offline
Joined: 10th Sep 2010
Location: Office Chair
Posted: 27th Nov 2012 18:04
Excellent. I've been going nuts. This means the function I got from the forum somewhere for DegreesToRad is faulty.

Thanks

My hovercraft is full of eels

Login to post a reply

Server time is: 2024-11-24 04:43:56
Your offset time is: 2024-11-24 04:43:56