#keep velocity in different directions
1 messages · Page 1 of 1 (latest)
I want to keep it dynamic
well let's not bother them! I'd just wait for anyone's help
the thing is, get velocity wouldn't work as it outputs a vector3 signal and the "speed" category of the velocity set takes a float input
I think it's different? I tried using get magnitude and it didn't work
maybe cryptic could help out if they're not busy 
Player Get velocity>get magnitude>add velocity
Or set velocity i forgot
Direction would be depending of the pivot point
Make sure the blue is where the portal "goes"
Since it's forward
Then take portal forward vector
As direction
Probably pivot point being wrong
I'm using a vector component to make sure, so it's not that the pivot is wrong
Rotate velocity by inverse of input portal rotation and save it into a vector3 variable
Rotate that vector by the rotation of output portal
I've done exactly that with the magnitude
Make sure to add velocity 3 frames after setting position else it fails
Can't you just use portal forward/up vector??
No, that doesnt account for roll, nor is it relative
Pretty confused
but that would make it so it would always be the inverse velocity, what if the portal is facing up, or down, or just the same way the player is facing
Why wouldn't it work?
Its not relative
Wdym by relative
No i meant
It wont work
Get the forward vector of the portal that you got out
My method is simple and works flawlessly
It's a little harde tbh 💀
Because that just launches you forward, not in the direction of your velocity relative to the input portal
but cryptic, wouldn't this happen?
Thats why you rotate by inverse of input portal rotation and rotate back by rotation of output portal
My method fixs that (Message above)
Not sure to understand exactly what your method does
Quaternion magic
Relative rotations
yeah no I have no idea what this means
sorry
so I get the velocity, do something to rotate it by the inverse of the initial portal rotation and put it in a vector3 variable?
how do I rotate it by the inverse of the portal? my brain is having a stroke
Same i don't get what he means by the inverse of the portal
no I get that
I don't
I don't get how I rotate the velocity
just the opposite direction of where you walk into the portal
okay but how do I rotate the velocity by the inverse of the portal though
that's the question
not what the inverse of the portal is
Get portal rotation
and what do I do with the portals rotation? how do I use it to rotate the velocity?
English isn't my first language so maybe I'm just not getting it
Inverse of portal rotation
Vector Rotate, Quaternion Inverse, Get Velocity, Get Rotation
I'm so confused why you need all of that
quaternion inverse...
💀
thanks Cryptic, been trying to do this for like 4 hours
Damn
Rotate velocity by inverse of Input portal rotation
Rotate the above value by the output portal rotation (NOT THE INVERSE OF OUTPUT PORTAL, just its rotation)
Mind explaining more in detail what all of this does
no, it just works
💀
I dont understand the quaternions
they just work
Man
after I rotate by the output portals rotation, how do I put that back into the player?
Velocity Set
So basically you just know how to do it cause you did already ? But like you don't rly understand quaternions?
yeah
Damn
but velocity set uses a float for speed right?
I understand how to use every quaternion chip
I just dont know what they do
All of them work on the same method
Direction Vector Magnitude * Speed
Have the speed be 1, and just plug in the normal vector
what?...
It rotates the vector by the input rotation
For example, (0,0,1) or global forward, rotated by the rotation of an object outputs the objects forward vector
If you input (0,1,0) into Set Velocity with a speed of 5, the player moves 5m/s in the input direction
if you input (0,5,0) into Set Velocity with a speed of 1, the player mvoes 5m/s in the input direction
Direction Vector Magnitude * Speed
It rotates the vector by the rotation of the object
(0,1,0) rotated by object rotation is the objects up vector
Yeah okay
by the way, by vector rotate do you guys mean "rotate vector"?
But do you understand like why you need to do all these inverse rotation and stuff for the portal system
oh yeah forgot its called that
cause that's the only chip there is
Oh it's not vector rotate?
Hmm
thats why its in Circuits\Math\Quaternion not Circuits\Math\Vector
Cryptic
Cause it just kinda confuse me why you gotta invert it and shit
it definitely says the chips aren't compatible. so it's a vector3
rotate vector can't connect to quaternion inverse
Rotating a vector by the inverse of object rotation gets the vector relative to that object
For example, if you rotate the velocity of your hand, by the inverse of your hand rotation, the resulting vector3 will be the velocity of your hand relative to your hand
Rotate the vector by the inverse of the rotation
Dont inverse the rotate vector, as that doesnt make sense
...
yeah I'm confused
this is a fucking tonguetwister
I just know it does
Think I got it
You mean you will get the velocity if the hand rotation was inverted right?
lemme link something one sec
But then why'd you invert it, why don't you just rotate velocity by output portal rotation...
Rotate their hand velocity by the inverse of their hand rotation
The resulting vector3 is the hands velocity relative to the handPositive X = Velocity relative to palm direction left hand. Opposite of palm direction right hand
Positive Y = Velocity relative to thumb direction of left and right hand
Positive Z = Velocity relative to finger direction of left and right handCheck if the Z velocity magnitude is greater than your threshold to detect if they are moving their hand forward
You can rotate this the vector by their rotation to make it relative to world space again
My brain isn't braining
Because quaternions are funky
You know how anything multiplied by 0 is 0? not with quaternions
You know how multiplication order doesnt matter? It does with quaternions
ok no, I give up. I just can't understand what the fuck I'm supposed to do.
too many rotations for my tiny goblin mind to understand
A * B = Rotate A by B
B * A = Rotate B by A
Man those quaternions
Who made these
Why is there even a W??!!!
Like
Useless bitch W
Get the rotation of the input portal (The one the player is entering)
Inverse that using Quaternion Inverse
Rotate the players velocity by this value ^^^ and save it into a vector3 variable
Rotate that vector3 variable by the rotation of the output portal (The one they are exiting)
The only part i don't get is why tf do you have to rotate velocity by the inverse of in portal rotation
💀
@hearty marten wait you're willing to do circuits for room earnings?
Entire rooms yeah
how do I use quaternion inverse on the rotation of the input portal? it's a vector3
The rotation of the input portal should be a quaternion
oh epic ill keep that in mind
Get first object with tag (portal tag) get rotation
You need the rotation of the portal, Get Rotation
Not the forward or up vector, those are different
alright, got that!
Cryptic mind doing that drawing but just give what the result of the first step is
Like rotate velocity by inverse quaternions
The result is a value
i dont know what it is, i dont even know what inversing a quaternion does
I just know you need to do it
No I mean
Heres a help
If you rotate (0,0,1) by an objects rotation, you get its forward vector
If you rotate an objects forward vector by the inverse of its rotation, you get (0,0,1)
I dont know if this makes sense but
It would be the direction relative to global rotation
I feel this..
Its the same thing but the other way around
Where'd you come from 💀
holy shit stevy wtf
But why the inverse of the rotation not just the rotation ?!
that was so fast
90 + 90 = 180
90 + -90 = 0
this but in 4 dimensions
Wait are rotations based o' the pivot point or just
Pivot point of object yeah
Yes
Meaning that the rotation would never change...
Ok, if you want to "Unrotate" something, do you keep adding to it, or do you subtract?
You subtract
So think of it like this
You are adding a negative value, aka subtracting
But if rotation is based off pivot point how is it even changing
Pivot point of object rotates and moves with object
what %
Like object rotate the same as the pivot point so the rotation doesn't change 💀
depends
was the entire game run on Cv2 (aka does the game not even function without Cv2)? 40% (Assuming its me and one person, I dont expect 40% when working with a team of people lol)
was it just a little section you needed but still everything? min 10%
the "blue" and "red" are vector components
it's still making me crash into the wall of the output portal
I'm facing the right way though
Think he sais you need a delay
(don't mind that get rotation at the bottom)
Or else it won't work
did they?
3 things:
- Do it 3 Cv2 ticks after (3 0 second delays, or like, just input
0.05which most the time is 3 ticks) - You might want to inverse the direction vector (scale by -1)
- Save velocity before entering setting position
Also you need to save the vector3 before set transform
Also, you want to do the same thing for the player
To make sure they are facing the right direction, rotate their forward vector by the inverse of input portal rotation, then rotate that by output portal rotation
This is the direction they should face when exiting a portal
Since he used a vector 3
Component
I don't think he need
It's always the right way...
cryptic is right
Oh wait nvm
what if the player walks in backwards into the portal
Same thing
You come out facing the portal direction this way
You want to face the direction relative to the way you were facing the input portal
I'm too tired to do this right now
💀
but also fuck quaterions
Still don't get why you have to rotate by the inverse of it ! Lets go!!!
I mean yeah thats how quaterions by most the time
"Wow these things are so cool and so useful" followed by "God this shit is fuckin stupid"
one thing before I finish, which one is the direction vector?
the last one I do before connecting to the velocity set?
yeah ok
you could also invert that
same effect, same CPU, different order
(Dont invert both lol)
Its like an XOR
++ = Wrong
-+ = Correct
-- = Wrong
+- = Correct
hold on
Are some people understanding quaternions?
I got a vector scale
Like bucket man maybe?
how do I scale by -1 lol
Parse int
thanks
oh god it works now
@hearty marten @marble iron thanks for the help, it took rubbing all 2 of my braincells together to get it working
for now it's just a one way portal but I'll just clone the circuits tomorrow, I wanna go to sleep with a win
💯
you dont need to clone the portals
Just have an event that tells you which portal is entrance and which is exit
now you need 1 system for infinite portals lol
my brain can't handle this anymore cryp, could you tell me exactly what to do to make this work? 
Instead of teleporting on trigger volume enter (I assume this is how you are doing it), send the portal event on trigger volume enter
When you enter Portal A, say portal A is input and portal B is output
When you enter Portal B, say portal B is input and portal A is output
Now when the event is received, you can teleport the player using that event instead of trigger volume enter
And that's why you can't do it with vector component I think
Hey cryptic. The thing is, I don't know how to make A or B be the input or output deoending on which event is sent
That's just above my cv2 knowledge
Its one event with 2 object inputs
When you enter portal A, send the event with A as input and B as output
When you enter portal B, send the event with portal B as input and portal A as output
You understand this because you know how to use it. To me this sounds like nothing.
I haven't dabbled in event senders or event receivers, apart from using the casual bool event or 30hz update
I have no idea how to send an event with A as input and B as output or the other way around
Sorry 
I'll just copy the circuits for the other way around
@marble iron did you understand how it worked? Maybe you could dumb it down for me.
Yeah
Event definition with a property
(rr object property)
The in he portal 1 and 2 trigger send an event
With portal 1 in portal 2 and portal 2 in 1
Then event receiver on your system
💯
Use an Event Definition chip
This will define an event, you can configure it to add/remove ports and datatypes
In this case you want to add 2 ports
A Rec Room Object port named "Input Portal", and Rec Room Object portal named "Output Portal"
Hi @hearty marten, sorry to bother you again but do you think you know how I can make the portal face the player? Right now I have the portal set to surface normal but I want it to rotate on the ground like it did in the game.
Any idea if it's possible?
Vector Dot the surface normal of the surface you are placing the portal on by (0,1,0)
Use Quaternion Create Look
If the Vector Dot value is NOT 1 or -1, use Quaternion Create Look with Forward being the surface normal, and Upward being (0,1,0)
If the Vector Dot value IS 1 or -1, use Quaternion Create Look with Forward being the surface normal, and Upward being (Player Position - Hit Position) * (1,0,1)
Make sure the Forward vector of both portals points in the direction the portal is facing, and make sure the up vector points towards the top of the portal
@river tree
@hearty marten after all this, how do I get the 2 options into the rotation itself?
Events?
if value
Yeah, I put an IF value and connected the then and else to a vector3 variable and a quaternion variable to update, but how do I get the values into the set transform? I can't connect both to it
And I can't think of any other way to do it
Should I ping you when we talk @hearty marten ? Or just wait until you get back
both should be quats
Oh
.
I had forgotten to put a quaternion create look
And it turns out you dont just scale by -1 to get it correct
What you actually have to do is reflect the vector along the portals surface normal
@hearty marten for some reason the portals invert my direction now? I haven't changed anything.
I don't know if it's just rec room having a lil moment or if it's actually broken. would you happen to know why this could've happened?
I can get on again and check it out
alright, when are you free?
when airlink connects
I'll save my battery, @ me when you get on
oh my god I hate this
To clarify for newer users to the post the might get redirected here!
The direction you need to save into a variable should be the player forward rotated by the inverse of the input portal rotation
The direction you set the player to on exit should be the saved forward direction, rotated by the output portal rotation, reflected by the normal of the output portal
You can reflect a vector easilly using Pancake922's Vector Reflect invention!
can you show me a circuit example of this
im a bit confused