Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > .NET Languages
You last visited: Today at 21:51

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[Help Request] Rotate a Point around a central point

Discussion on [Help Request] Rotate a Point around a central point within the .NET Languages forum part of the Coders Den category.

Reply
 
Old   #1
 
DXStriker's Avatar
 
elite*gold: 0
Join Date: Jan 2009
Posts: 194
Received Thanks: 86
[Help Request] Rotate a Point around a central point

Hey E*PvP Community,
At the moment im coding a 2D Radar for a game called Assault Cube.
First of all i have to say that i got very far in this project , but now i'm at a point where i need help.

I need the calculation to rotate a point(Enemy) around a central point(me). Yesterday i got a calculation (i don`t know the site anymore), but i think it don`t need credits, because math is universal.

Conversion from World to Radar Point
Code:
    Private Function ConvertWorldPointToRadarPoint(ByVal X As Single, ByVal Y As Single) As Point
        Dim sx, sy As Int32 'X/Y distance between us and enemy (multiplied by zoom)'
        Dim x2, y2 As Single
        Dim rot As Single = P1Yaw * ((2 * PI) / 360) 'Degree to Radian'
        Dim localPlayerX As Single = P1X
        Dim localPlayerY As Single = P1Y
        sx = Convert.ToInt32((localPlayerX - X) * (NumericUpDown1.Value / 2) + (Me.Width / 2))
        sy = Convert.ToInt32((localPlayerY - Y) * (NumericUpDown1.Value / 2) + (Me.Height / 2))
        'Maybe left handed system used???? X increases to left?' 
        x2 = Convert.ToSingle((Me.Width / 2) + (Math.Cos(rot)) * (sx - (Me.Width / 2)) - Math.Sin(rot) * (sy - (Me.Width / 2))) 'rotate a point around a central point'
        y2 = Convert.ToSingle((Me.Height / 2) + (Math.Sin(rot)) * (sx - (Me.Height / 2)) + Math.Cos(rot) * (sy - (Me.Height / 2)))

        Return New Point(x2, y2)
    End Function
There is a little mistake in this calulation which i dont know... Maybe there is a left handed system used? X increases to left?

Here is a Vid which shows my Radar:
I put in some Youtube music, because i dont want you to hear my crapy Skype conversation ;D
DXStriker is offline  
Old 03/17/2013, 23:49   #2
 
DXStriker's Avatar
 
elite*gold: 0
Join Date: Jan 2009
Posts: 194
Received Thanks: 86
#Push weiß niemand rat?
DXStriker is offline  
Old 03/18/2013, 03:48   #3
 
elite*gold: 0
Join Date: May 2010
Posts: 793
Received Thanks: 268
scheint so als würdest du einfach um 180 grad bzw pi zuviel/zuwenig rotieren, versuch mal " P1Yaw * ((2 * PI) / 360)" zu "PI + P1Yaw * ((2 * PI) / 360)" zu ändern.
nkkk is offline  
Thanks
1 User
Old 03/19/2013, 23:24   #4
 
DXStriker's Avatar
 
elite*gold: 0
Join Date: Jan 2009
Posts: 194
Received Thanks: 86
Quote:
Originally Posted by nkkk View Post
scheint so als würdest du einfach um 180 grad bzw pi zuviel/zuwenig rotieren, versuch mal " P1Yaw * ((2 * PI) / 360)" zu "PI + P1Yaw * ((2 * PI) / 360)" zu ändern.
Vielen dank für die Hilfe! Ich habe dadurch eine idee bekommen, bzw. etwas rumprobiert und kann hiermit die Lösung des Problems präsentieren!:

Code:
Dim rot As Single = PI + (P1Yaw + 90) * ((2 * PI) / 360) 'Grad zu Radian'
DXStriker is offline  
Reply

Tags
hack, radar, radar problem, rotating


Similar Threads Similar Threads
[Guide] How to walk from point to point using AutoIt
06/30/2022 - Cabal Guides & Templates - 6 Replies
Today I feel a bit generous to share my AutoIt script and how I use it to move my character from one location to another. Credits to Wayntressierts for the release of wallhack using AutoIt as I use it for this function. Note that this guide is a work in progress. I will post it bit by bit until the whole function is complete. I have limited time because of my gigs but nonetheless, I promise to complete this for those who are willing to learn scripting. Ok let's get to work. You need...
[FS] FREESTYLE street Basketball 3 Point, Rebound, and 2 point Hack
06/11/2012 - General Gaming Discussion - 133 Replies
My cousin was just hired as product manager for levelup philippines, he says the team for freestyle philippines knows all the available hacks and cheats, including the: 1. 3 point hack 2. rebound hack 3. and he even told me theres a 2 point hack they need to know these hacks for them to solve it. i will share these hacks and cheats in a little while.



All times are GMT +2. The time now is 21:54.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.