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] Is there a way to get an objects normals as 3D world angles?

Author
Message
ando
4
Years of Service
User Offline
Joined: 21st Feb 2020
Location: Australia
Posted: 24th Jan 2022 00:24 Edited at: 24th Jan 2022 00:26
Using the following code I can place a bullet hole plane in 3d world coords no problem.
But using GetObjectRayCastNormal provides results from -1 to 1.

Is there a way to get the angles from where a ray hits an object as 0 to 360 3D world angles ?

Just trying to convert my old code to AGKS but it's not as easy as I thought it would be.
I've tried lots of ways including vectors and Quats but no go so far.
Thanks.

BASIC appeared in May 1964. Lightning flashed, the wind roared and the Earth moved.
And nine months later I was born.
So here I am.
I am Basic.
Code is in my genes.

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

Go to answer

Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 24th Jan 2022 01:33 Edited at: 24th Jan 2022 01:34
This post has been marked by the post author as the answer.
ando
4
Years of Service
User Offline
Joined: 21st Feb 2020
Location: Australia
Posted: 24th Jan 2022 02:19
No, didn't think of that one. Was too busy with my own hack attacks.
Thanks very much VN, I'll take a look.
BASIC appeared in May 1964. Lightning flashed, the wind roared and the Earth moved.
And nine months later I was born.
So here I am.
I am Basic.
Code is in my genes.
ando
4
Years of Service
User Offline
Joined: 21st Feb 2020
Location: Australia
Posted: 24th Jan 2022 02:58 Edited at: 24th Jan 2022 21:09
Thanks VN, that works excellent.
And that's too easy to be a hack.

EDIT: SetObjectLookAt() was the key to getting it working. It's a very versatile command. Thanks again Virtual Nomad. I should check the online help as it seems to have more than the built in help.
There is a bullet holes demo below people are free to use.
It's set up for static targets but maybe it could work on mobile targets if the bullet hole plane is set as child of the moving target.

BASIC appeared in May 1964. Lightning flashed, the wind roared and the Earth moved.
And nine months later I was born.
So here I am.
I am Basic.
Code is in my genes.

Attachments

Login to view attachments

Login to post a reply

Server time is: 2024-04-26 21:04:27
Your offset time is: 2024-04-26 21:04:27