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.

DarkBASIC Professional Discussion / Math Used to Rotate Basic2D

Author
Message
ArcherSam
15
Years of Service
User Offline
Joined: 13th Mar 2011
Location: Florida, US
Posted: 26th Mar 2011 01:37
Hey,

I'm having a little trouble figuring out how to turn a BASIC2D CIRCLE using math.

Here's the code to create circle, indicator, and to control:



My guess is to modify the XPos using a equation with cos() and modify the YPos using a equation with sin(). I'm not completely sure and need help. Thanks!

Sam
Max P
16
Years of Service
User Offline
Joined: 23rd Jan 2010
Location:
Posted: 26th Mar 2011 12:32
I don't really understand what you want to do, but if you want to modify the x and y position based on a circle you need to use the following:

Neuro Fuzzy
19
Years of Service
User Offline
Joined: 11th Jun 2007
Location:
Posted: 26th Mar 2011 23:57
Yes. what Max P said. If you want to make it rotate around the center of the screen, you can do:



As you increase "Angle", the point at (Xpos,Ypos) rotates around the center of the screen.

ArcherSam
15
Years of Service
User Offline
Joined: 13th Mar 2011
Location: Florida, US
Posted: 30th Mar 2011 03:58
I uploaded a picture to explain what i'm trying to do, and included code for experimentation. Sorry about the confusion.

ArcherSam
15
Years of Service
User Offline
Joined: 13th Mar 2011
Location: Florida, US
Posted: 30th Mar 2011 04:06
Opps! I forgot to label each point to its variable name. Here's the image showing labeling each point to the variable.
baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 30th Mar 2011 15:11
Try this:


I just used sin/cos to get a vector to point 'B' and then reversed (and halved) the vectors to get the 'A' and 'C' points.

Hope that makes sense!

baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 1st Apr 2011 16:41
Did that help?

Kind of dispiriting to spend 15-20 minutes helping out with no response...

I'll assume you are just getting on with your game and got lost in thought. That happens to me a lot

Agent
21
Years of Service
User Offline
Joined: 7th Sep 2004
Location: Sydney, Australia
Posted: 4th Apr 2011 01:25
Don't you hate when that happens - you solve someone's problem for them and you don't even get a "ta, that worked"
ArcherSam
15
Years of Service
User Offline
Joined: 13th Mar 2011
Location: Florida, US
Posted: 4th Apr 2011 17:58
Hey, sorry about the delayed response; the past week I was making preperations for my senior prom that occured last weekend.

The code provided by baxslash works perfectly. I'll have to brush up on my understanding of vectors to interpret how the use of vectors produce the desired results. Thanks a lot!

The game i'm building is called Armsq2 influenced by Asteroid and the mini-maps of Rainbow Six Vegas.

I am really sorry for the delayed response, last week was very busy.
baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 7th Apr 2011 10:45
No problem, glad I could help. Just hoping it had helped really

Login to post a reply

Server time is: 2026-07-17 13:58:40
Your offset time is: 2026-07-17 13:58:40