Page 1 of 1

Wondering how Dan did this..

Posted: June 5th, 2011, 1:37 am
by Nekoneko
Saw this vid long ago, and thought pff. who cares

http://www.xfire.com/video/356c3d/

Now Im dying to know how the script works.
Would be awesome if anyone could help me on this.

Re: Wondering how Dan did this..

Posted: June 5th, 2011, 1:41 am
by Drofder2004
Rotate the entire room?

Re: Wondering how Dan did this..

Posted: June 5th, 2011, 3:39 am
by _DanTheMan_
This script uses two separate rooms, where the second room is an upside down version of the first. When you touch the trigger, you are teleported to the upside down room's ceiling (which is like the floor of the room you were in before) and turned upside down, then rotated and moved to the floor.

The rotating script, where 'time' is the distance between the floor and the ceiling divided by a set speed:

Code: Select all

self setPlayerAngles((self getPlayerAngles()[0]*-1, (self getPlayerAngles()[1]*-1) - 180, 180));
for(i = 0;i/20 < time;i++)
{
	self setPlayerAngles(self getPlayerAngles() - (0, 0, (180/time)/20));
	wait 0.05;
}

Re: Wondering how Dan did this..

Posted: June 5th, 2011, 10:17 am
by Nekoneko
Dan himself replied :D

Uh. I thought it was something else as setplayerangles :/
But thanks

Re: Wondering how Dan did this..

Posted: June 5th, 2011, 2:43 pm
by Pedsdude
You thought he actually changed the direction of gravity :P

Re: Wondering how Dan did this..

Posted: June 5th, 2011, 2:50 pm
by Nekoneko
haha, no, but I thought he somehow linked the player to a script_model and turned it, since the movement looked so smooth.

Re: Wondering how Dan did this..

Posted: June 5th, 2011, 4:23 pm
by Drofder2004
_DanTheMan_ wrote:This script uses two separate rooms, where the second room is an upside down version of the first. When you touch the trigger, you are teleported to the upside down room's ceiling (which is like the floor of the room you were in before) and turned upside down, then rotated and moved to the floor.

The rotating script, where 'time' is the distance between the floor and the ceiling divided by a set speed:

Code: Select all

self setPlayerAngles((self getPlayerAngles()[0]*-1, (self getPlayerAngles()[1]*-1) - 180, 180));
for(i = 0;i/20 < time;i++)
{
	self setPlayerAngles(self getPlayerAngles() - (0, 0, (180/time)/20));
	wait 0.05;
}
A lot more elaborate than I thought, but in essence the same thing.

May I ask the point of the "180/time", or simply why the distance of the room matters. I might just be missing something, but creating a smooth view rotation can be accomplished with a set value...

Re: Wondering how Dan did this..

Posted: June 5th, 2011, 6:34 pm
by _DanTheMan_
Drofder2004 wrote:May I ask the point of the "180/time", or simply why the distance of the room matters. I might just be missing something, but creating a smooth view rotation can be accomplished with a set value...
The 180/time and the distance of the room mattered in this script because it was made to be used for multiple rooms, which may have different ceiling heights (so it would move you at the same speed regardless of the height of the room).

Re: Wondering how Dan did this..

Posted: June 5th, 2011, 6:48 pm
by Nekoneko
But my problem is, it gets less smooth, the faster it is.
Guess you cant help it tho x.x

Re: Wondering how Dan did this..

Posted: June 6th, 2011, 8:02 am
by matt101harris
DANIEL!!!!!!!!!!!!!!!!!!!!!!!!!!!!! I havent seen you for AGES!!!!!!!!!!!!!!!!!!!!