#keep velocity in different directions

1 messages · Page 1 of 1 (latest)

river tree
#

most of the portal guns I've seen on the invention store either stop all movement when teleporting, face the wrong way or just output a constant velocity to launch the player in.

#

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 RRbeehead

marble iron
#

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

river tree
#

I'm using a vector component to make sure, so it's not that the pivot is wrong

hearty marten
#

Rotate velocity by inverse of input portal rotation and save it into a vector3 variable

Rotate that vector by the rotation of output portal

river tree
#

I've done exactly that with the magnitude

hearty marten
#

Make sure to add velocity 3 frames after setting position else it fails

marble iron
hearty marten
marble iron
#

Pretty confused

river tree
marble iron
hearty marten
marble iron
#

Wdym by relative

hearty marten
marble iron
#

No i meant

hearty marten
marble iron
#

Get the forward vector of the portal that you got out

hearty marten
#

My method is simple and works flawlessly

marble iron
#

It's a little harde tbh 💀

hearty marten
marble iron
#

Oh thattt

#

Ok mb

river tree
hearty marten
#

Thats why you rotate by inverse of input portal rotation and rotate back by rotation of output portal

hearty marten
marble iron
#

Not sure to understand exactly what your method does

hearty marten
#

Quaternion magic
Relative rotations

river tree
#

sorry

marble iron
#

I kinda get it but still kinda confuse

#

💀

river tree
#

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

marble iron
#

Same i don't get what he means by the inverse of the portal

river tree
#

no I get that

marble iron
#

I don't

river tree
#

I don't get how I rotate the velocity

river tree
marble iron
#

Ohh

#

Scale to -1 probably if it's that

river tree
#

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

marble iron
#

Get portal rotation

river tree
#

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

marble iron
#

Same

#

Vector3 rotate btw

#

It's a chip

river tree
#

don't patronize me like that...

#

I know what a vector3 chip is

marble iron
#

"Vector 3 rotate"

#

It's a chip 💀

hearty marten
marble iron
#

I'm so confused why you need all of that

river tree
#

quaternion inverse...

marble iron
#

💀

river tree
#

thanks Cryptic, been trying to do this for like 4 hours

marble iron
#

Damn

hearty marten
marble iron
#

Mind explaining more in detail what all of this does

hearty marten
marble iron
#

💀

hearty marten
#

I dont understand the quaternions
they just work

marble iron
#

Man

river tree
marble iron
#

So basically you just know how to do it cause you did already ? But like you don't rly understand quaternions?

marble iron
#

Damn

river tree
#

but velocity set uses a float for speed right?

hearty marten
#

I understand how to use every quaternion chip
I just dont know what they do

marble iron
#

Do you know what vector3 rotate does exactly

#

Kinda confused on this one

hearty marten
river tree
#

what?...

hearty marten
marble iron
#

Ohhh

#

So it kinda set the vector direction as the rotation of the objecy

#

Object*

hearty marten
# river tree what?...

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

hearty marten
# marble iron Object*

It rotates the vector by the rotation of the object

(0,1,0) rotated by object rotation is the objects up vector

marble iron
#

Yeah okay

river tree
#

by the way, by vector rotate do you guys mean "rotate vector"?

marble iron
#

But do you understand like why you need to do all these inverse rotation and stuff for the portal system

hearty marten
river tree
#

cause that's the only chip there is

marble iron
#

Oh it's not vector rotate?

hearty marten
#

yeah, Rotate Vector

#

is technically a quaternion chip, not a vector chip

marble iron
#

Hmm

hearty marten
#

thats why its in Circuits\Math\Quaternion not Circuits\Math\Vector

marble iron
#

Cause it just kinda confuse me why you gotta invert it and shit

river tree
#

rotate vector can't connect to quaternion inverse

marble iron
#

It can

#

2nd input I think

hearty marten
hearty marten
#

Dont inverse the rotate vector, as that doesnt make sense

river tree
#

yeah I'm confused

hearty marten
#

dont worry about how it works lol

#

im not entirely sure

river tree
#

this is a fucking tonguetwister

hearty marten
#

I just know it does

marble iron
#

Think I got it

#

You mean you will get the velocity if the hand rotation was inverted right?

hearty marten
#

lemme link something one sec

marble iron
#

But then why'd you invert it, why don't you just rotate velocity by output portal rotation...

hearty marten
#

Rotate their hand velocity by the inverse of their hand rotation
The resulting vector3 is the hands velocity relative to the hand

Positive 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 hand

Check 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

marble iron
#

My brain isn't braining

hearty marten
#

You know how anything multiplied by 0 is 0? not with quaternions

marble iron
#

Now wtf..

#

Quaternions just saying "no"

hearty marten
#

You know how multiplication order doesnt matter? It does with quaternions

river tree
#

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

hearty marten
#

A * B = Rotate A by B
B * A = Rotate B by A

marble iron
#

Man those quaternions

#

Who made these

#

Why is there even a W??!!!

#

Like

#

Useless bitch W

hearty marten
marble iron
#

The only part i don't get is why tf do you have to rotate velocity by the inverse of in portal rotation

#

💀

wise plank
#

@hearty marten wait you're willing to do circuits for room earnings?

hearty marten
river tree
hearty marten
wise plank
marble iron
hearty marten
river tree
#

alright, got that!

marble iron
#

Cryptic mind doing that drawing but just give what the result of the first step is

#

Like rotate velocity by inverse quaternions

hearty marten
#

I just know you need to do it

marble iron
#

No I mean

hearty marten
#

Heres a help

marble iron
#

Like with 1 portal only

#

What direction would the output be with first step

hearty marten
#

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)

marble iron
#

What...

#

Get the first one

#

Second one is

#

confusing

hearty marten
worthy trellis
hearty marten
marble iron
hearty marten
#

holy shit stevy wtf

marble iron
#

But why the inverse of the rotation not just the rotation ?!

hearty marten
#

that was so fast

hearty marten
#

this but in 4 dimensions

marble iron
#

Wait are rotations based o' the pivot point or just

hearty marten
marble iron
#

And now i'm lost again

#

Doesn't the pivot point rotate with the object

hearty marten
#

Yes

marble iron
#

Meaning that the rotation would never change...

hearty marten
#

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

marble iron
#

But if rotation is based off pivot point how is it even changing

hearty marten
wise plank
marble iron
#

Like object rotate the same as the pivot point so the rotation doesn't change 💀

hearty marten
# wise plank what %

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%

river tree
#

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

marble iron
#

Think he sais you need a delay

river tree
#

(don't mind that get rotation at the bottom)

marble iron
#

Or else it won't work

river tree
#

did they?

marble iron
#

3 frame

#

I think...

hearty marten
marble iron
#

Also you need to save the vector3 before set transform

hearty marten
#

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

marble iron
#

Since he used a vector 3

#

Component

#

I don't think he need

#

It's always the right way...

river tree
#

cryptic is right

marble iron
#

Oh wait nvm

river tree
#

what if the player walks in backwards into the portal

hearty marten
marble iron
#

Again I forgot yeah

#

Nvm

#

Nvm

river tree
#

I'm too tired to do this right now

hearty marten
#

im very glad you pinged me

#

I like quaternions

marble iron
#

💀

hearty marten
#

but also fuck quaterions

marble iron
#

Still don't get why you have to rotate by the inverse of it ! Lets go!!!

hearty marten
#

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"

river tree
#

the last one I do before connecting to the velocity set?

river tree
#

yeah ok

hearty marten
#

same effect, same CPU, different order

#

(Dont invert both lol)

#

Its like an XOR

#

++ = Wrong
-+ = Correct
-- = Wrong
+- = Correct

river tree
#

hold on

marble iron
#

Are some people understanding quaternions?

river tree
#

I got a vector scale

marble iron
#

Like bucket man maybe?

river tree
#

how do I scale by -1 lol

marble iron
#

Parse int

river tree
#

thanks

river tree
#

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

marble iron
#

💯

hearty marten
#

Just have an event that tells you which portal is entrance and which is exit

#

now you need 1 system for infinite portals lol

river tree
#

my brain can't handle this anymore cryp, could you tell me exactly what to do to make this work? RRwah

hearty marten
#

Now when the event is received, you can teleport the player using that event instead of trigger volume enter

marble iron
#

And that's why you can't do it with vector component I think

river tree
#

That's just above my cv2 knowledge

hearty marten
river tree
#

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 RRpensive

#

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.

marble iron
#

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

#

💯

hearty marten
#

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"

river tree
#

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?

hearty marten
# river tree Hi <@524421250848784395>, sorry to bother you again but do you think you know ho...

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

river tree
#

@hearty marten after all this, how do I get the 2 options into the rotation itself?

#

Events?

river tree
#

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

hearty marten
#

both should be quats

river tree
#

Oh

river tree
#

I had forgotten to put a quaternion create look

hearty marten
#

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

river tree
#

@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?

hearty marten
river tree
hearty marten
#

when airlink connects

river tree
#

I'll save my battery, @ me when you get on

river tree
#

oh my god I hate this

hearty marten
#

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!

upbeat quarry
#

im a bit confused