DuaLVII
|
  |
| Joined: 27 Jun 2016 |
| Total Posts: 18 |
|
|
| 17 Jul 2016 08:43 AM |
Hey Guys,
One thing I hate, is not being able to figure things out myself.
Usually in other languages / games with scripting api, Rotation is done on a world axis and not relative to the objects axis which is simple to make them rotate on their own axis and some languages just have 2 sets of functions, one for basic rotate and one for local rotate.
So far I found 3 different ways of rotation in Roblox with the same result and no doubt there are more ways to rotate objects exactly the same way (Which I find a bit unnecessary)
Those 3 ways being; part.Rotation = ... part.CFrame = part.CFrame * CFrame.Angles(math.rad(... part.CFrame = part.CFrame * CFrame.fromEulerAnglesXYZ(math.rad(...
Initially I thought that the last 2 ways of rotation had their axis set on the part.CFrame and therefore tried a zero vector but it just positioned it to 0,0,0 but still rotating on it's own local axis.
So basically what I'm asking is, is there a way of rotating an object on a world axis and not on the objects axis.
Thanks, DuaLVII |
|
|
| Report Abuse |
|
|
Isosta
|
  |
| Joined: 10 May 2015 |
| Total Posts: 14729 |
|
|
| 17 Jul 2016 09:56 AM |
multiply a cframe by another cframe or use toworldspace
- Isosta |
|
|
| Report Abuse |
|
|
|
| 17 Jul 2016 10:01 AM |
Remove "part.CFrame * "
part.CFrame = CFrame.Angles(math.rad( |
|
|
| Report Abuse |
|
|
DuaLVII
|
  |
| Joined: 27 Jun 2016 |
| Total Posts: 18 |
|
|
| 17 Jul 2016 10:32 AM |
Heya,
I have already tried using another CFrame and as for toWorldSpace, I can't see how that one would work since if you were to apply any kind of rotation using CFrame.Angles, toWorldSpace would just return nil.
Removing part.CFrame * would also not work, Doing this would just bring the object to a zero vector position while rotating (again) on it's own axis and not to the world axis.
So, Still unsolved. |
|
|
| Report Abuse |
|
|
Isosta
|
  |
| Joined: 10 May 2015 |
| Total Posts: 14729 |
|
|
| 17 Jul 2016 10:35 AM |
part.CFrame * (CFrame.new() * CFrame.Angles())
- Isosta |
|
|
| Report Abuse |
|
|
DuaLVII
|
  |
| Joined: 27 Jun 2016 |
| Total Posts: 18 |
|
|
| 17 Jul 2016 10:59 AM |
This would be no different than doing part.CFrame * CFrame.Angles(math.rad(....
But I see what you were trying to do, Unfortunately, that is not the solution as the object just rotates around it's own axis and not the world axis. |
|
|
| Report Abuse |
|
|
DuaLVII
|
  |
| Joined: 27 Jun 2016 |
| Total Posts: 18 |
|
|
| 17 Jul 2016 11:53 AM |
| Sorry, Just bumping this due to spam pushing this post back a page. |
|
|
| Report Abuse |
|
|
|
| 17 Jul 2016 12:07 PM |
The reason ROBLOX doesn't have a dedicated set of world axis rotation functions is because it is not too difficult to code on your own.
Here is an easy way to rotate an object from world axis.
x,y,z = workspace.Trigger.CFrame:toEulerAnglesXYZ() workspace.Trigger.CFrame = CFrame.new(workspace.Trigger.CFrame.p) * CFrame.Angles(0, math.rad(25), 0) * CFrame.Angles(x,y,z) |
|
|
| Report Abuse |
|
|
ray_1
|
  |
| Joined: 18 Feb 2011 |
| Total Posts: 464 |
|
|
| 17 Jul 2016 12:12 PM |
dont use euler angles
part.CFrame = p.CFrame * CFrame.fromAxisAngle(part.CFrame:vectorToObjectSpace(Vector3.new(0,1,0)),math.rad(1))
Recommended username: DetailedRay_1
|
|
|
| Report Abuse |
|
|
|
| 17 Jul 2016 12:15 PM |
| Mine does work fine but his works fine too I just tested it. Just make sure "part" and "p" are both the same thing. |
|
|
| Report Abuse |
|
|
ray_1
|
  |
| Joined: 18 Feb 2011 |
| Total Posts: 464 |
|
|
| 17 Jul 2016 12:16 PM |
no dont use euler angles
Recommended username: CulturedRay_1
|
|
|
| Report Abuse |
|
|
| |
|
ray_1
|
  |
| Joined: 18 Feb 2011 |
| Total Posts: 464 |
|
|
| 17 Jul 2016 12:19 PM |
http://wiki.roblox.com/index.php?title=User:MrNicNac/CFrame_Cheat_Sheet/proto#Inefficiency_of_Euler_Angles
Recommended username: FunctionalRay_1
|
|
|
| Report Abuse |
|
|
|
| 17 Jul 2016 12:21 PM |
Can you possibly send me to a page that doesn't warn me that the page is trying to attack my computer? Thanks.
"Inefficiency_of_Euler_Angles" just sounds like someone got butthurt over someone's theorem when ROBLOX uses the same laws to calculate its rotated parts. |
|
|
| Report Abuse |
|
|
|
| 17 Jul 2016 12:24 PM |
@Speedy
Lol, remove the s in https. Apparently I heard some forum admin's made it direct to https. |
|
|
| Report Abuse |
|
|
|
| 17 Jul 2016 12:24 PM |
| I heard, not apparently I heard. |
|
|
| Report Abuse |
|
|
ray_1
|
  |
| Joined: 18 Feb 2011 |
| Total Posts: 464 |
|
|
| 17 Jul 2016 12:25 PM |
try copy pasting the link, it seems to be trying to load in https for some reason
also this guy is stating facts the page also has some cool information
Recommended username: ForgetfulRay_1
|
|
|
| Report Abuse |
|
|
DuaLVII
|
  |
| Joined: 27 Jun 2016 |
| Total Posts: 18 |
|
|
| 17 Jul 2016 12:30 PM |
Hey Speedy,
You hit the hammer on the nail with that. I somewhat facepalmed when seeing the obvious and applied it into the script which worked well.
Many thanks to you on that.
Clearly angles isn't my strong suit. |
|
|
| Report Abuse |
|
|
|
| 17 Jul 2016 12:33 PM |
| Nono. I mean I believe ray_1 when he posts that, because I've recieved some rotational issues as well but if you're hardcoding anyways then you may as well work with what is there. |
|
|
| Report Abuse |
|
|
|
| 17 Jul 2016 12:37 PM |
fundamentally definition
in central or primary respects.
"Euler Angles are fundamentally the wrong way to store rotation."
I don't see what's wrong here.
It's like saying 'respect the elderly'
nope. |
|
|
| Report Abuse |
|
|
ray_1
|
  |
| Joined: 18 Feb 2011 |
| Total Posts: 464 |
|
|
| 17 Jul 2016 12:39 PM |
i dont understand your analogy
"ROBLOX uses the same laws to calculate its rotated parts." roblox uses matrices
Recommended username: ComfortableRay_1
|
|
|
| Report Abuse |
|
|
|
| 17 Jul 2016 12:41 PM |
It's not an analogy.
It's definitions. |
|
|
| Report Abuse |
|
|
ray_1
|
  |
| Joined: 18 Feb 2011 |
| Total Posts: 464 |
|
|
| 17 Jul 2016 12:45 PM |
"It's like saying 'respect the elderly'"
Recommended username: VictoriousRay_1
|
|
|
| Report Abuse |
|
|
|
| 17 Jul 2016 12:47 PM |
It is like it.
"in central or primary respects."
The website you gave as a source states that 'it is fundamentally the wrong way'. |
|
|
| Report Abuse |
|
|
|
| 17 Jul 2016 12:48 PM |
| It's considered respectful to open the door for woman, but unless their my friend I'm not even going to consider it. |
|
|
| Report Abuse |
|
|