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] Position objects at an angle from camera, facing it

Author
Message
marvin944
10
Years of Service
User Offline
Joined: 27th Aug 2013
Location:
Posted: 21st Nov 2019 21:11
My camera is at 0,0,0 facing to 0 degrees. I would like to write a function that gets a position for an object to place at a certain angle and distance from the camera. E.g: PlaceObject(angle as float, distance as integer)

Any ideas?
Dutch

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

Go to answer

blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 21st Nov 2019 21:44
This post has been marked by the post author as the answer.
Assuming that the angle is through the Y-Axis and the camera is looking down the z-axis
marvin944
10
Years of Service
User Offline
Joined: 27th Aug 2013
Location:
Posted: 21st Nov 2019 21:54
AH, that's a clever one. i used math:

BM[screennr,objectnr]._x=str(_depth#*cos(_angle#))
BM[screennr,objectnr]._y=str(_height#)
BM[screennr,objectnr]._z=str(_depth#*sin(_angle#))
Dutch
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 21st Nov 2019 22:56
Math is a tool of the devil

Login to post a reply

Server time is: 2024-04-19 07:09:46
Your offset time is: 2024-04-19 07:09:46