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 / Plot circle from sphere surface?

Author
Message
PartTimeCoder
AGK Tool Maker
9
Years of Service
User Offline
Joined: 9th Mar 2015
Location: London UK
Posted: 12th Jan 2022 23:51 Edited at: 12th Jan 2022 23:51
I know, high school math, right?

I can plot a circle from a flat plane but how do I account for the angle of the object in 3d space?

I have the position and angle of the "city" object and want to map a 32 point circle above and parallel with its angle and for the life of me I can not figure it out

A mock up of what I am trying to achieve, had an idea for a "drone" tower and want them to circle the city they are assigned to, any ideas?
Open Source plugins
Cl - DnD Plugin
Buy Me A Coffee

Attachments

Login to view attachments
PartTimeCoder
AGK Tool Maker
9
Years of Service
User Offline
Joined: 9th Mar 2015
Location: London UK
Posted: 13th Jan 2022 09:57 Edited at: 13th Jan 2022 09:57
Nevermind, I cheated, reset the object position and rotation, cast a circle of objects and fix them to the "City" object and move it back to where it was, from there I can map the temp objects locations and store them in an array and finally delete the objects, now I have a circular path above each city no matter its angle ....



Got to love it when a hack comes together
Open Source plugins
Cl - DnD Plugin
Buy Me A Coffee

Attachments

Login to view attachments
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 14th Jan 2022 05:24
When you "Fix" an object to an object it translates the real world co-ordinates to the target object's co-ordinates.
So if your objectA is at position (5,5,5). When you attach it to objectB then object A will be at (5,5,5) within the co-ordinate system of ObjectB regardless of where objectB may be positioned or rotated
PartTimeCoder
AGK Tool Maker
9
Years of Service
User Offline
Joined: 9th Mar 2015
Location: London UK
Posted: 14th Jan 2022 08:19
Yes indeed but only when calling GetObjectXYZ, when calling GetObjectWorldXYZ it retrieves the real world co-ords regardless of its parents position.
Open Source plugins
Cl - DnD Plugin
Buy Me A Coffee
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 14th Jan 2022 21:36 Edited at: 14th Jan 2022 21:37
I cheated, reset the object position and rotation
You don't have to do this step
PartTimeCoder
AGK Tool Maker
9
Years of Service
User Offline
Joined: 9th Mar 2015
Location: London UK
Posted: 14th Jan 2022 22:49
Yes you are right, just create the circle at 0,0,0 and then use Fix** and it inherits the city objects position and rotation, I was trying to do it in the city's location hence why it was not working so I reset the object to 0,0,0 only to realize there was no need, just plot the circle there and fix it, job done

I opted to perform all these tasks at startup and store everything concerning paths and mapping in an array to free up processing power for other tasks, I am close to having something that's actually playable now I should be able to post a vid by the end of the weekend
Open Source plugins
Cl - DnD Plugin
Buy Me A Coffee
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 15th Jan 2022 18:22
Make a vector from the city to where you want the circle. With that direction vector you can just cast out your 32 points from there. Or do you want the circle to match the curvature of the sphere?
Tiled TMX Importer V.2
XML Parser V.2
Base64 Encoder/Decoder
Purple Token - Free online hi-score database
Legend of Zelda

"I like offending people, because I think people who get offended should be offended." - Linus Torvalds

PartTimeCoder
AGK Tool Maker
9
Years of Service
User Offline
Joined: 9th Mar 2015
Location: London UK
Posted: 15th Jan 2022 19:52 Edited at: 15th Jan 2022 19:53
Not match the curvature no but the angle of the city object beneath it

They say a picture paints a thousand words



I have enemy units attacking the citys and the easiest way I could think to have them circle above the city while its lopped at an angle was this, when the city is created at start-up I simply cast the circle and put the city in its position and log the position of the circle objects to a Vector3 array then delete them, ^^ that image is my debug mode drawing my saved data, all the different circles and lines represent locations I need in the game for enemy spawn points, attack paths and such so a enemy unit has a databank of paths it can follow depending on what unit type and where on the globe is is assigned to, each land section has its own unique set of spawn points and paths so I can spawn in units randomly so 1 game session never plays out the same ... for the most part it works pretty well, just a second or 2 start up delay while it loads everything and generates the path data but I can live with that knowing I have minimal processing overhead with enemy path finding, but the path mapping array is just data so when I got everything in there I need I can just save it out to json and load that at start-up as well and cut that delay out .....
Open Source plugins
Cl - DnD Plugin
Buy Me A Coffee

Attachments

Login to view attachments
smerf
19
Years of Service
User Offline
Joined: 24th Feb 2005
Location: nm usa
Posted: 14th Feb 2022 01:26
this project looks very cool i wanted to do some similar stuff with procedural generated heightmaps but never got around to it.

Login to post a reply

Server time is: 2024-04-20 01:50:01
Your offset time is: 2024-04-20 01:50:01