SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 04/02/2019, 02:28 AM   #1
Lunoxx
Big Clucker
 
Join Date: Feb 2015
Posts: 53
Reputation: 0
Default Need help with spatial geometry

Hello, I`m trying to make a crane system, it`s complete, but, I need help to get REAL position of crane magnet, this magnet is an attached object to another object and I don`t know how I can get real position, not attached offsets.
Is any method?

Thank you!
__________________
Skype: alin.m99
Discord: lunoxx#1155
FB Page: f.a.c.e.book.com/pawnscripts
Lunoxx is offline   Reply With Quote
Old 04/02/2019, 09:25 AM   #2
Kaliber
High-roller
 
Kaliber's Avatar
 
Join Date: Jun 2012
Location: Localhost
Posts: 1,061
Reputation: 149
Default Re: Need help with spatial geometry

When i am not complete wrong, its just the x,y,z of the crane +offsetX, +offsetY, +offsetZ of the magnet
__________________
Kaliber is offline   Reply With Quote
Old 04/02/2019, 09:51 PM   #3
Lunoxx
Big Clucker
 
Join Date: Feb 2015
Posts: 53
Reputation: 0
Default Re: Need help with spatial geometry

Quote:
Originally Posted by Kaliber View Post
When i am not complete wrong, its just the x,y,z of the crane +offsetX, +offsetY, +offsetZ of the magnet
Good idea, I tried right now, but, don`t work..

Quote:
Originally Posted by ****** View Post
Assuming the crane rotates, you need trigonometry. Look up how to find a point on a circle.
Can you give me a small example, please?
__________________
Skype: alin.m99
Discord: lunoxx#1155
FB Page: f.a.c.e.book.com/pawnscripts
Lunoxx is offline   Reply With Quote
Old 04/02/2019, 10:18 PM   #4
MEGADETHS
Little Clucker
 
MEGADETHS's Avatar
 
Join Date: Jan 2019
Posts: 20
Reputation: 0
Default Re: Need help with spatial geometry

This is what I use create an explosion infront of the player. Not sure how good it is but it works, i think if you mess around with the code and the formula enough you can make your thing work.

PHP Code:
new Float:x;
new 
Float:y;
new 
Float:z;

new 
Float:PlayerFacingAngle;
new const 
Float:DISTANCE 3.0;
GetPlayerFacingAngle(playeridPlayerFacingAngle);
PlayerFacingAngle PlayerFacingAngle-180.0;
new 
Float:F_FLOATSIN floatsin(-PlayerFacingAngledegrees);
new 
Float:F_FLOATCOS floatcos(-PlayerFacingAngledegrees);

F_FLOATSIN = -F_FLOATSIN;
F_FLOATCOS = -F_FLOATCOS;

GetPlayerPos(playeridx,z);

CreateExplosion(DISTANCE F_FLOATSINDISTANCE F_FLOATCOSz60); 
MEGADETHS is offline   Reply With Quote
Old 04/02/2019, 10:37 PM   #5
IstuntmanI
High-roller
 
IstuntmanI's Avatar
 
Join Date: Mar 2009
Location: Romania
Posts: 1,802
Reputation: 375
Default Re: Need help with spatial geometry

Maybe you need this exact same thing: https://forum.sa-mp.com/showthread.php?t=586841.
__________________


IstuntmanI is offline   Reply With Quote
Old 04/02/2019, 11:05 PM   #6
Lunoxx
Big Clucker
 
Join Date: Feb 2015
Posts: 53
Reputation: 0
Default Re: Need help with spatial geometry

Quote:
Originally Posted by IstuntmanI View Post
Maybe you need this exact same thing: https://forum.sa-mp.com/showthread.php?t=586841.
Thank you verry much!
Now, I need to know real rotations of attached object.
__________________
Skype: alin.m99
Discord: lunoxx#1155
FB Page: f.a.c.e.book.com/pawnscripts

Last edited by Lunoxx; 05/02/2019 at 01:21 AM.
Lunoxx is offline   Reply With Quote
Old 05/02/2019, 02:48 AM   #7
Pottus
High-roller
 
Pottus's Avatar
 
Join Date: Jun 2012
Posts: 4,833
Reputation: 1296
Default Re: Need help with spatial geometry

Quote:
Originally Posted by Lunoxx View Post
Thank you verry much!
Now, I need to know real rotations of attached object.
Using that function isn't going to help you then! You need something else.

https://github.com/Pottus/Texture-St...dio/tsmain.pwn
Line 1610

Code:
AttachPoint(Float:offx, Float:offy, Float:offz, Float:offrx, Float:offry, Float:offrz, Float:px, Float:py, Float:pz, Float:prx, Float:pry, Float:prz, &Float:RetX, &Float:RetY, &Float:RetZ, &Float:RetRX, &Float:RetRY, &Float:RetRZ, sync_rotation = 1)
The first six parameters is your attached object's XYZ/RXRYRZ offsets the next 6 parameters is the XYZ/RXRYRZ in which the the attached object is attached to.

Returns the actual position xyz/rxryrz of the attached object.
Pottus is offline   Reply With Quote
Old 05/02/2019, 03:00 PM   #8
Lunoxx
Big Clucker
 
Join Date: Feb 2015
Posts: 53
Reputation: 0
Default Re: Need help with spatial geometry

I did something like: https://i.imgur.com/KQYZLSn.png, for test.. but, don`t work. Returns is only attached offsets of magnet. What`s wrong in my code?
Thank you for your response!

@Pottus
__________________
Skype: alin.m99
Discord: lunoxx#1155
FB Page: f.a.c.e.book.com/pawnscripts
Lunoxx is offline   Reply With Quote
Old 05/02/2019, 03:57 PM   #9
Pottus
High-roller
 
Pottus's Avatar
 
Join Date: Jun 2012
Posts: 4,833
Reputation: 1296
Default Re: Need help with spatial geometry

Quote:
Originally Posted by Lunoxx View Post
I did something like: https://i.imgur.com/KQYZLSn.png, for test.. but, don`t work. Returns is only attached offsets of magnet. What`s wrong in my code?
Thank you for your response!

@Pottus
Because you are using two sets of offsets that is not that this function does! You need to calculate from a static XYZ/RXRYRZ point for this to work.
Pottus is offline   Reply With Quote
Old 05/02/2019, 05:08 PM   #10
Lunoxx
Big Clucker
 
Join Date: Feb 2015
Posts: 53
Reputation: 0
Default Re: Need help with spatial geometry

Quote:
Originally Posted by Pottus View Post
Because you are using two sets of offsets that is not that this function does! You need to calculate from a static XYZ/RXRYRZ point for this to work.
I tried to calculate position for Crane Cabine, from crane base which is an real object, single "real object" from this crane, but, returns is invalid position, I will try again, probably I used wrong parameters.
__________________
Skype: alin.m99
Discord: lunoxx#1155
FB Page: f.a.c.e.book.com/pawnscripts
Lunoxx is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Pawno Geometry cengiz6155 Scripting Help 26 25/04/2018 12:46 PM


All times are GMT. The time now is 03:33 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.