#how to check if rider rotation is same as ride?
1 messages · Page 1 of 1 (latest)
@silent rock sorry for pinging, but why did my last post got deleted?
I can't say; I'm not sure, sorry.
Oh
Damn, I'm on this problem for so long now
I'm remembering just to check if there is an rotation and than run the gametest the whole time until the gametest detects that the rotation is same
Would be event check and than speed function
There's q.yaw_speed too
But not sure about up and down rotation
query.eye_target_x_rotation
query.eye_target_y_rotation
Use these
Why do you need this btw?
I can't seem to think of any way this is useful for
Ohh
Sure these will return 0 ?
I just want an signal when the player is rotating again
(Signal when he moves his head)
They will return the rotation of the player.
Only the player?
Oh
Actually I need to check if player rot matches entity rot
But not sure if that is even possible
Just compare the rot query for the player with the entity
Target rotating didn't worked
K
},
"controller.animation.turn": {
"initial_state": "default",
"states": {
"default": {
"transitions": [
{
"turn": "\n (\n (\n (\n q.has_player_rider ? (\n v.rider_entity -> (q.head_y_rotation(0))\n )\n ) != q.head_y_rotation(0)\n ) || (\n (\n q.has_player_rider ? (\n v.rider_entity -> (q.head_x_rotation(0))\n )\n ) != q.head_x_rotation(0)\n )\n) && q.health >= 10 && q.mark_variant == 3"
},
{
"hover": "q.has_rider && q.mark_variant == 2"
}
]
},
"turn": {
"transitions": [
{
"default": "1"
}
],
"on_entry": [
"@s flying",
"/say fly"
]
},
"hover": {
"transitions": [
{
"default": "1"
}
],
"on_entry": [
"/function glide"
]
}
}```
@vital fractal
And yea, the \n doesn't cause the issue that it's always true
But u probably know
Ye
Did
Didn't changed anything I think
Yep
Don't change anything
@vital fractal
I think your molang is wrong too
How
You didn't define v.rider_entity
I did before
Idk why it's away
But it didn't worked
It was just getting the first entity
You first need to get the rider or riding array
With
q.get_ride
Or
q.get_riders
Don't only this exist?
Yea, it was doing that
But idk why, but it's lost
Like wtf
Why is it not there anymore
Hm
"v.player_rot = 0; for_each(v.player, query.get_riders, { v.player_rot = v.player->q.head_y_rotation(0); }); return v.player_rot;"
"q.head_y_rotation == v.player_rot"
I think if you do this inside the entity that the player is riding it should work.
Oh, alr, leme try
But I wrote this quickly so it may need some fixing.
Any success?
Was in school, but I'll try now
Okay
Could you hook it up to a scoreboard?
To check the value of v.player_rot
How
Idk how to do that
Uhmm
I never did
I'm kinda confused, cuz it stops after it's right once I think
Btw its really hard to match the exact rotation
Could you send your full animation controller.
K
Its actually working,but just once
(Ik the x rotation isn't inside, bit we gotta make the y one work first anyway)
},
"controller.animation.turn": {
"initial_state": "default",
"states": {
"default": {
"transitions": [
{
"turn": "(q.head_y_rotation(0) != v.player_rot) && q.health >= 10 && q.mark_variant == 3"
},
{
"hover": "q.has_rider && q.mark_variant == 2"
}
],
"on_entry": [
"v.player_rot = 0; for_each(v.player, query.get_riders, { v.player_rot = v.player->q.head_y_rotation(0); }); return v.player_rot;"
]
},
"turn": {
"transitions": [
{
"default": "1"
}
],
"on_entry": [
"@s flying",
"/say fly"
]
},
"hover": {
"transitions": [
{
"default": "1"
}
],
"on_entry": [
"/function glide"
]
}
}```
@vital fractal
Wait,
what does turn state do?
And why are you comparing up and down to left and right?
Because it should get executed as long as it's not the same
As soon as the player rotation matches it should stop
Yes and what reactivates it?
The query
K
{
"format_version": "1.10.0",
"animation_controllers": {
"controller.animation.tie_fighter": {
"states": {
"default": {
"transitions": [
{
"something": "q.head_y_rotation(0) != v.player_rot"
}
],
"on_entry": [
"v.player_rot = 0; for_each(v.player, query.get_riders, { v.player_rot = v.player->q.head_y_rotation(0); }); return v.player_rot;"
],
"on_exit": [
"/say true"
]
},
"something": {
"transitions": [
{
"default": "true"
}
]
}
}
}
}
}
Oh, but it needs an second state too
Oh yeah I forgot wait.
Ah
try this to debug it.
K,
It's a simplified version
Ah
It just keeps saying true
hmmm
Oh, k
Now there's nothing at all
I'm an idiot.
Remove the on_exit at the first state and put it by the second state
Nah
It gets triggered the whole time
I removed the == and changed it to an! = back again
Also the fly event isn't triggering
@vital fractal
Uh
@vital fractal we should try fix the other one who did worked partwise
(This:)
},
"controller.animation.turn": {
"initial_state": "default",
"states": {
"default": {
"transitions": [
{
"turn": "(q.head_y_rotation(0) != v.player_rot) && q.health >= 10 && q.mark_variant == 3"
},
{
"hover": "q.has_rider && q.mark_variant == 2"
}
],
"on_entry": [
"v.player_rot = 0; for_each(v.player, query.get_riders, { v.player_rot = v.player->q.head_y_rotation(0); }); return v.player_rot;"
]
},
"turn": {
"transitions": [
{
"default": "1"
}
],
"on_entry": [
"@s flying",
"/say fly"
]
},
"hover": {
"transitions": [
{
"default": "1"
}
],
"on_entry": [
"/function glide"
]
}
}```
It's very confusing
@prisma siren
Oh, this looks complicated asf
Oh, well, I think in that case I could use gametest too
That's actually better.
I am litterly no js expert ¯\_(ツ)_/¯
Uh
@vital fractal found the issue
It's the variable
It somehow don't set right when it stopped once
Because when I'm triggering speed so the hover state activates and than go back to the normal state it works again
But not sure how I could fix that
Welp
@prisma siren
Because the variable only works inside the default state.
Make sure it works in all states.
How you mean?
Also it's in the default state when it's not working..
When inside hover state it stops since the variable isn't updated in that state, only in default.
Yea, but that's obvious
So put the variable also in hover state
The hover state isn't the problem.. The problem is that after the fly state becomes false once it won't become true again
Only when switch to hover and back again
Yes because it isnt activated in the fly state
Could you send your AC
k
Accidentally sent wrong letter, lmao, sorry,
I can barely see when there's the sun shining on my phone
Or wait, leme send code
},
"controller.animation.turn": {
"initial_state": "default",
"states": {
"default": {
"transitions": [
{
"turn": "(q.head_y_rotation(0) != v.player_rot) && q.health >= 10 && q.mark_variant == 3"
},
{
"hover": "q.has_rider && q.mark_variant == 2"
}
],
"on_entry": [
"v.player_rot = 0; for_each(v.player, query.get_riders, { v.player_rot = v.player->q.head_y_rotation(0); }); return v.player_rot;"
]
},
"turn": {
"transitions": [
{
"default": "1"
}
],
"on_entry": [
"@s flying",
"/say fly"
]
},
"hover": {
"transitions": [
{
"default": "1"
}
],
"on_entry": [
"/function glide"
]
}
}```
@vital fractal
Hmm did you already put it in the molang to scoreboard thing?
That usually works alright with debugging
Not yet, cuz I was confused how
How
What?
script?
Gametest