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: SetRoll does weird things to the mouse.

Previous Thread :: Next Thread 
1waffle1 is online. 1waffle1
Joined: 16 Oct 2007
Total Posts: 16381
11 Jul 2013 01:41 PM
When the camera is rotated, the Mouse's UnitRay doesn't take GetRoll into consideration at all. Camera:SetRoll(math.pi) inverts the way mouse.Hit and mouse.Target is interpreted in the game.
Report Abuse
Radioaktiivinen is not online. Radioaktiivinen
Joined: 25 Apr 2009
Total Posts: 18629
11 Jul 2013 03:01 PM
ofc, the feature was just hacked in for cool visual effects.
Report Abuse
Oysi is not online. Oysi
Joined: 06 Jul 2009
Total Posts: 9058
11 Jul 2013 03:05 PM
[ Content Deleted ]
Report Abuse
1waffle1 is online. 1waffle1
Joined: 16 Oct 2007
Total Posts: 16381
11 Jul 2013 03:06 PM
eww. I'm trying to do everything with trig. that's cheating.
Report Abuse
digpoe is not online. digpoe
Joined: 02 Nov 2008
Total Posts: 9092
11 Jul 2013 03:07 PM
Can't you just... wave a magic wand and everything'll work?

:c
Report Abuse
ArceusInator is not online. ArceusInator
Joined: 10 Oct 2009
Total Posts: 30553
11 Jul 2013 03:18 PM
I guess I have to save the day with my rotate_ray function

pastebin/d3pAbvS4
Report Abuse
1waffle1 is online. 1waffle1
Joined: 16 Oct 2007
Total Posts: 16381
11 Jul 2013 03:19 PM
What I am trying to do is to have the camera follow where your mouse is on the sphere, while looking at the center of the sphere with the Z normal facing the mouse. This can be done only with SetRoll (or by rotating the multi-thousand part icosphere.) There are a lot of cases where the camera likes to flip around and not face the same direction, though, and I don't know what to do about that.
Report Abuse
1waffle1 is online. 1waffle1
Joined: 16 Oct 2007
Total Posts: 16381
11 Jul 2013 03:22 PM
My solution for the inverse mouse was just reversing the direction so it moved "away" from your mouse when the camera was rolled. The camera still acts flippy at the poles, though.
Report Abuse
Oysi is not online. Oysi
Joined: 06 Jul 2009
Total Posts: 9058
11 Jul 2013 03:30 PM
[ Content Deleted ]
Report Abuse
Oysi is not online. Oysi
Joined: 06 Jul 2009
Total Posts: 9058
11 Jul 2013 03:34 PM
[ Content Deleted ]
Report Abuse
Oysi is not online. Oysi
Joined: 06 Jul 2009
Total Posts: 9058
11 Jul 2013 03:43 PM
[ Content Deleted ]
Report Abuse
HaxHelper is not online. HaxHelper
Joined: 19 Dec 2009
Total Posts: 1208
11 Jul 2013 03:43 PM
your camera is flippy at the poles?

it's funny because that's a problem I was having (and one which I still haven't fixed)

ill_finish_it_later.png
Report Abuse
ArceusInator is not online. ArceusInator
Joined: 10 Oct 2009
Total Posts: 30553
11 Jul 2013 03:45 PM
"that's definitely not what he wants."

I interpreted this problem as "UnitRay doesn't take SetRoll into account". My function fixes that problem. Did I misinterpret the problem?
Report Abuse
1waffle1 is online. 1waffle1
Joined: 16 Oct 2007
Total Posts: 16381
11 Jul 2013 03:56 PM
That problem has been solved now. The remaining problem is the flippy camera.
Report Abuse
Oysi is not online. Oysi
Joined: 06 Jul 2009
Total Posts: 9058
11 Jul 2013 04:01 PM
[ Content Deleted ]
Report Abuse
noobertuber is not online. noobertuber
Joined: 16 Jan 2007
Total Posts: 2321
11 Jul 2013 05:31 PM
I discovered this a few months ago when working on an Escher 2D thingy. Unfortunately, when I posted about it here, the topic was deleted... Now I'm waiting...

In the end, it just required a bit of trigonometry to fix, as 1waffle1 was doing.

-God Bless-
Report Abuse
1waffle1 is online. 1waffle1
Joined: 16 Oct 2007
Total Posts: 16381
11 Jul 2013 09:01 PM
I ran this code:
for i=-10,10 do
workspace.Camera.CoordinateFrame=CFrame.Angles(math.rad(i),0,0)*CFrame.new(Vector3.new(0,150,0),Vector3.new()) print(workspace.Camera.CoordinateFrame:components())
wait(.6)
end

and this is what it printed (numbers shortened because roblox.) The marked lines are where the camera flipped.

0,147.721,-26.047,0,1,0,0.173,0,0.984,0.984,0,-0.173
0,148.153,-23.465,0,1,0,0.156,0,0.987,0.987,0,-0.156
0,148.540,-20.875,0,1,0,0.139,0,0.990,0.990,0,-0.139 -----
0,148.881,-18.280,0,1,0,0.121,0,0.992,0.992,0,-0.121
0,149.178,-15.679,0,1,0,0.104,0,0.994,0.994,0,-0.104
...
0,148.881,18.280,0,1,0,-0.121,0,0.992,0.992,0,0.121
0,148.540,20.875,0,1,0,-0.139,0,0.990,0.990,0,0.139
0,148.153,23.465,0,1,0,-0.156,0,0.987,0.987,0,0.156 -----
0,147.721,26.047,0,1,0,-0.173,0,0.984,0.984,0,0.173

Why would those lines be the ones that flip? Nothing is inverting, becoming zero, anything like that.
Report Abuse
1waffle1 is online. 1waffle1
Joined: 16 Oct 2007
Total Posts: 16381
11 Jul 2013 09:13 PM
More precisely, -8.109 radians and 8.11 radians are where it switches. It makes more sense that it would flip at 0, though. and now there's something else within that particular angle, whatever that may be.
Report Abuse
Oysi is not online. Oysi
Joined: 06 Jul 2009
Total Posts: 9058
11 Jul 2013 09:16 PM
[ Content Deleted ]
Report Abuse
1waffle1 is online. 1waffle1
Joined: 16 Oct 2007
Total Posts: 16381
11 Jul 2013 09:25 PM
I took that CFrame and changed it to CFrame.new(that.p,Vector3.new()) and this is the new output, which makes more sense in why it is flipping, but no sense at all in why it is flipping in this particular spot. The last number is the radians.

0, 148.503, 21.135,-0, 1, -0, -0.140, 0, 0.990, 0.990, 0, 0.140 8.1
0, 148.503, 21.137,-0, 1, -0, -0.140, 0, 0.990, 0.990, 0, 0.140 8.101
0, 148.502, 21.140,-0, 1, -0, -0.140, 0, 0.990, 0.990, 0, 0.140 8.102
0, 148.502, 21.142,-0, 1, -0, -0.140, 0, 0.990, 0.990, 0, 0.140 8.103
0, 148.502, 21.145,-0, 1, -0, -0.140, 0, 0.990, 0.990, 0, 0.140 8.104
0, 148.501, 21.148,-0, 1, -0, -0.140, 0, 0.990, 0.990, 0, 0.140 8.105
0, 148.501, 21.150,-0, 1, -0, -0.141, 0, 0.990, 0.990, 0, 0.141 8.106
0, 148.500, 21.153,-0, 1, -0, -0.141, 0, 0.990, 0.990, 0, 0.141 8.107
0, 148.500, 21.155,-0, 1, -0, -0.141, 0, 0.990, 0.990, 0, 0.141 8.108
0, 148.500, 21.158,-0, 1, -0, -0.141, 0, 0.990, 0.990, 0, 0.141 8.109
0, 148.499, 21.161, 1, 0, -0, -0, 0.141, 0.989, 0,-0.989, 0.141 8.11
Report Abuse
Oysi is not online. Oysi
Joined: 06 Jul 2009
Total Posts: 9058
11 Jul 2013 09:42 PM
[ Content Deleted ]
Report Abuse
1waffle1 is online. 1waffle1
Joined: 16 Oct 2007
Total Posts: 16381
11 Jul 2013 09:46 PM
That does the same thing. It goes part-way, rotates 90 degrees, goes a bit more, rotates 90 more degrees and then finishes.
Report Abuse
Oysi is not online. Oysi
Joined: 06 Jul 2009
Total Posts: 9058
11 Jul 2013 10:09 PM
[ Content Deleted ]
Report Abuse
bohdan77 is not online. bohdan77
Joined: 10 Aug 2008
Total Posts: 7944
11 Jul 2013 10:34 PM
Weird roblox bug?
Report Abuse
1waffle1 is online. 1waffle1
Joined: 16 Oct 2007
Total Posts: 16381
11 Jul 2013 10:53 PM
It is supposed to be upsidown half the way because it is moving in that direction. It isn't supposed to be backwards half the way, though, and it isn't supposed to suddenly jolt from one orientation to another.
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