doPlayerTeleport Change Request: Relative Rotations

Author Topic: doPlayerTeleport Change Request: Relative Rotations  (Read 1495 times)

i've had an idea in my head for an illusion that could be done with doPlayerTeleport (it's not very different from what's already been done in the original thread), but in order for it to work currently, i'd have to spend a lot of extra space having four copies of the same map so that seamless teleports could be done through some hallways. instead i figured a little addition to the mod would hopefully be to its benefit, so here's what i'm proposing


the current state of the mod allows me to do this (it's all a top down view of some plates on the ground):

i tell A to teleport me the moment i step off of it, everything works perfectly, this is what is already known but i figured i'd illustrate it so you understand the next couple of images.


the trick i'm trying to pull looks more like this:

two things change here: the player is rotated exactly 180 degrees relative to their previous facing direction, and the player is teleported to a point on B that is directly across the brick from where they were on A. both the player's camera and the point they teleport to needs to be rotated 180 degrees around the center of the brick.


unfortunately, since the only options for changing a player's view with the mod is absolute, i get this instead:

and i can't check the second box or the absolute rotation will refuse to work in the first place


so my proposal would be to change the dropdown menu a little by adding a few options.
instead of just:

there would also be the options "90", "180", and "270". (and the relative option stays exactly the same but would essentially also represent a 0 or 360 degree rotation)


now, by selecting 180, the teleport looks more like this:

of course, i end up in the center of B because i haven't told my position to change 180 degrees around the plate as well,


so finally i check the relative position box and i get what i'm looking for, this:

hooray! hopefully that makes sense. there are probably even better ways of implementing this but this is what came to my mind first.
« Last Edit: January 03, 2017, 05:29:16 AM by .:FancyPants:. »

The issue with the rotation is that it has four values of which I have no clue what either do. For bricks, there are only four possible rotations so that's easy. But for players, I'd need to experiment with it. Or see if the teledoor code has something useful and it's not in a hidden place.

this is doable with a bit of trig/lin alg. i'll do it today

i rambled on about this in discord for a while and then threw the math part together really quick, duno how quality it is cus it's been ages since i've done any modding, but all that's left would be to shove it into an event

http://pastebin.com/Vyd7jh7d

The issue with the rotation is that it has four values of which I have no clue what either do. For bricks, there are only four possible rotations so that's easy. But for players, I'd need to experiment with it. Or see if the teledoor code has something useful and it's not in a hidden place.
both bricks and players only rotate on the Z axis. torque uses axis rotation and that's what those four values are, but you can use axisToEuler/eulerToAxis to switch to and from euler rotation values which are in simple degrees. since i've never bothered to learn how axis rotation works, that's what i did
« Last Edit: January 03, 2017, 12:08:10 PM by otto-san »


it feels like otto has the right math to figuring out this whole ordeal, if anyone wanted to download the base mod from here (same link as chrisbot's from the original thread) and tie the math into the teleport, that would be super awesome

Didn't the older setPlayerTransform event have a relative directional setting?

Didn't the older setPlayerTransform event have a relative directional setting?
it always set you to the center of the brick. it only retained your looking direction

Oh, I misinterpreted that.
There are region events, but they're a bit odd to work with.