generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Math Help

Previous Thread :: Next Thread 
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
05 Jun 2017 07:12 PM
I've written 3 differentiable parametric equations that each map to a component of a positional vector in 3D space: x(theta), y(theta), and z(theta). I also have their derivatives. Normally to get the angle about a slope you can take the arctangent of the rate of change and so in 2D (assuming we care just about axes x and y) I'd just have to rotate an object by the arctangent of dy/dx (dy/dx = dy/dtheta / dx/dtheta via chain rule). However in 3D space there are 3 axes I can rotate about instead of 1. The goal is to solve for the euler angles (or perhaps another way if there is a better way) I need to rotate this object such that it matches the curve.

I figured that to get the angle I need to rotate about Y, I just need to take the arctangent of dx/dz and the angle to rotate about X seemed to be arctangent of dy/dh where dh/dtheta comes by the pythagorean theorem and attaching the correct sign:
as in: dy/dh = dy/dtheta / dh/dtheta
where dh/dtheta = sqrt(dx/dtheta^2 + dy/dtheta^2)
Although I'd have to manually sign dh/dtheta as the signedness is lost which I have done as:
if dx_dtheta has the same sign as dz_dtheta then
dh_dtheta = -dh_theta

I'm not sure exactly why this works but it (seems) to work
However assuming everything is correct (and it seems to be), my problem now is how would I solve for the angle to rotate about z
puu.sh/wbmGr/6d4f953244.png
tl;dr I'm trying to smooth out a curve via taking the arctangent of the rate of change but since this is a 3D problem I don't really know exactly how to get all of the angles. I think I got angle about X and Y correct (or so it seems) but don't know how to get the angle about Z
Report Abuse
szkiller is not online. szkiller
Joined: 21 Feb 2014
Total Posts: 360
05 Jun 2017 07:24 PM
Too much... Math... I can handle Operators and logic... But I cant handle too much math D:

Whenever I see % and ^ I die
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
05 Jun 2017 08:53 PM
aaaaaaaaa
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
06 Jun 2017 12:12 AM
bbbbbbbb
Report Abuse
GodShowsTheWay is not online. GodShowsTheWay
Joined: 27 Oct 2014
Total Posts: 7180
06 Jun 2017 12:23 AM
omg cntkillme is asking for help

this math is beyond 99% of the people on this forum, including me


Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
06 Jun 2017 03:32 AM
cccccccccc
Report Abuse
GraphicsSettings is not online. GraphicsSettings
Joined: 12 Sep 2013
Total Posts: 2883
06 Jun 2017 03:39 AM
omg cntkillme is asking for help [2]

im not intelligent enough, understandable have a nice day
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
06 Jun 2017 04:25 AM
I mean it's just what you'd learn in any high school calculus course. The problem is that it's a 3D problem aaaaaa
Report Abuse
szkiller is not online. szkiller
Joined: 21 Feb 2014
Total Posts: 360
06 Jun 2017 04:28 AM
Too much math


Aaaaaaaa

Kill me pls
Report Abuse
dance1211 is not online. dance1211
Joined: 09 Apr 2008
Total Posts: 1091
06 Jun 2017 04:58 AM
The solution is you need another equation phi(theta) that represents the roll of the path the parametric equation curve is taking. If you imagine a roller coaster, you can have the track go in a perfectly straight line or you can have the train roll around it. We are trying to find the equation of the rotation as a function of theta (more specifically as a function of x,y,z and phi) because if we don't have phi, we lose a degree of freedom that we desperately need to make this smooth. What is this phi we're looking for? It is the function such that dr/dtheta (where r is the rotation vector) is minimised over some measure we want. That means the the rotation is as smooth as possible. The best example is when in the loop as it goes up, you have that big rotation. We want the rotation to be as small as possible.

So what you are looking for right now is if your current rotation vector is (X,Y,Z) where X,Y,Z are your current functions of theta that give you your rotation values, you need (X,Y,Z + phi(theta) instead.

I'll message you later about how to calculate phi using numerical methods
Report Abuse
Disillusions is not online. Disillusions
Joined: 10 Jul 2011
Total Posts: 6365
06 Jun 2017 05:00 AM
^ gj


Report Abuse
SinisterMemories is not online. SinisterMemories
Joined: 21 Mar 2013
Total Posts: 4892
06 Jun 2017 05:44 AM
let me ask my math teacher


#code print("oh no an errorz!")
Report Abuse
Stilect is not online. Stilect
Joined: 04 Nov 2015
Total Posts: 10857
06 Jun 2017 05:48 AM
We're not calculators. off.
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
06 Jun 2017 08:43 PM
Some of the problems I've been having is because I forgot that arctangent's range is between -pi/2 and pi/2... aaaaaaaaaaaaaaaaaaa
Report Abuse
BunnyBoy26 is not online. BunnyBoy26
Joined: 17 Jun 2010
Total Posts: 5674
06 Jun 2017 09:11 PM
Not sure if this is what you are going for, but you can try looking into a TNB-Frame (Google it, Frenet-Serret).

Roblox actually offers a generally accurate function for retrieving angles: CFrame:toEulerAnglesXYZ().

Also, to address issues with arctangent, use math.atan2(x,y). It handles the cases when x and/or y are negative.
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
07 Jun 2017 01:36 AM
Yes but again that's not the problem. That just happens to be one of them. And toEulerAnglesXYZ is useless because if I was able to get the angles it would mean I would have the correct CFrame to begin with.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image