#Late

1 messages · Page 1 of 1 (latest)

pine bane
orchid hemlock
#

ok

#

so

#

it teleports you when you fall of the platform?

#
void tp()
    {
        if (player.transform.position.y - platform.transform.position.y < -50)
        {
            transform.position = new Vector3(transform.position.x, startposition.y, transform.position.z);
            Debug.Log("fax");


        }
    }```
#

@pine bane

pine bane
#

it doesnt teleport me back

#

in update

#

but... in lateupdate

#

it does teleport me to the y position that I state in the code

orchid hemlock
#

ok

#

so

#

why not just check if the distance between them is grater than 50

pine bane
#

with my code that I am using now

orchid hemlock
#

ok try with mine

pine bane
#

alright

pine bane
orchid hemlock
#

was it in update or late update?

pine bane
orchid hemlock
pine bane
#

i just keep falling

orchid hemlock
#

for how long?

#

@pine bane

pine bane
#

i let it go on for like 10 seconds

orchid hemlock
pine bane
#

i fell pretty far

orchid hemlock
#

declare a float

#

that you can see in the inspector

pine bane
#

kk did it

orchid hemlock
#

and put it in the if instead of the 50

pine bane
#

what do i set the float to

orchid hemlock
pine bane
orchid hemlock
#

-10

#

or less

#

or more

#

just modify it until something happens

pine bane
#

kk ill try it

#

-10 didnt do it

#

is there a reason why lateupdate works for it tho

orchid hemlock
#

not that i know

#
void Update()
    {
float distance = player.transform.position.y - platform.transform.position.y;
print(distance);
        if (distance <= inspectorFloat)
        {
            transform.position = new Vector3(transform.position.x, startposition.y, transform.position.z);
            Debug.Log("fax");
        }
    }
#

ok try this

#

and see the results

#

@pine bane

pine bane
#

ill try it ty

#

whats inspector float

orchid hemlock
pine bane
orchid hemlock
pine bane
#

nope

orchid hemlock
#

what does it output

#

?

#

@pine bane

pine bane
#

it outputs

#

just numbers going diown

orchid hemlock
#

ok but does it show the distance between the platform and player?

pine bane
#

wdym by show

#

if u mean prints

#

then yes

#

it just keeps decreasing

orchid hemlock
#

ok so

orchid hemlock
orchid hemlock
#

what happens

pine bane
#

let me see

#

its negative

#

but nothing teleports

orchid hemlock
#

ok let me think something

#
void Update()
    {
float distance = player.transform.position.y - platform.transform.position.y;
print(distance);
print(distance <= inspectorFloat);
        if (distance <= inspectorFloat)
        {
            transform.position = new Vector3(transform.position.x, startposition.y, transform.position.z);
            Debug.Log("fax");
        }
    }
#

@pine bane try the new print

pine bane
orchid hemlock
pine bane
orchid hemlock
#

< less than
<= less than or equal

pine bane
#

i still dont teleport

orchid hemlock
orchid hemlock
pine bane
orchid hemlock
pine bane
orchid hemlock
pine bane
#

um i dont know there were a tons of numbers popping up idk which is whic

#

does that print a bool

orchid hemlock
#

yes

pine bane
#

it printed false

#

13333 times

orchid hemlock
#

what is the inspector float set to?

orchid hemlock
#

=

pine bane
#

it printed true for a bit then started doing false again

orchid hemlock
#

how weird

#

ok so

pine bane
#

ig it just has to be in lateupdate

orchid hemlock
#
void Update()
    {
float distance = player.transform.position.y - platform.transform.position.y;
bool above = distance > inspectorFloat;
        if (!above)
        {
print("down");
            transform.position = new Vector3(transform.position.x, startposition.y, transform.position.z);
            Debug.Log("fax");
        } else {
print("above");
}
    }```
#

@pine bane

pine bane
#

alrighty let me test

#

still dont teleport

orchid hemlock
#

ok just changed a bit

#

try the new

pine bane
#

still dont teleport

#

ig it just needs to be lateupdate

orchid hemlock
#

and the console?

pine bane
#

i just dont know why

#

it printed above 1000 times

#

and false 5000 times

orchid hemlock
#

when did it print false?

#

@pine bane

pine bane
#

wdym

#

it always printed false

orchid hemlock
pine bane
#

down was never printed

orchid hemlock
#

ok and if the player is under the platform?

pine bane
#

bc down is never printed

#

its fine tysm for ur help. I am thankful u put a ton of time. i gtg for now. if u want to keep figuring it out with me i can tell u when i get back it shouldnt be long.

#

have a good day

orchid hemlock
#

ok

#

you too

pine bane
#

boxfriend figured it out

#

all the math and work u were doing was completely right

#

we had it right the issue was the character controller

orchid hemlock
#

xd

#

well

pine bane
#

tysm for ur help tho

orchid hemlock
#

np
good luck

pine bane
#

I have a question

#

someone asked this and i gave an answer i just want to make sure it was a good way

#

how would u go about doing this
how
so i have an input
how do i make the character point in the NE when the W and D keys are pressed
i just want to understand the logic, dont need code

orchid hemlock
#

whats NE?

pine bane
orchid hemlock
#

well first you need to define the north east

#

then check if the inputs are pressed

#

and

#

then if i'm not mistaken

#

you can set the transform.forward as your north east

pine bane
#

my idea was if you can inputs from w and d then add to a vector2

#

that vector2 is your direction

#

so if you only do a

#

then add 1 to a certain place

#

is that a bad idea

#

adding to a vector2 and making that vector2 ur direction

orchid hemlock
#

well you probably can

#

declare a the vector2 and make the transform.forward that vector normalized

pine bane
#

wont it already be normalized tho

#

if you are just adding 1

#

then its already normalized

#

right?

orchid hemlock
#

normalizing when having 1, 1

#

is like 0.707, 0.707

pine bane
orchid hemlock
#

here a guy explained it

pine bane
#

u can normalize at 1,1?

pine bane
#

🤣

orchid hemlock
#

🤣

pine bane
#

is there any other way to rotate a player with direction

orchid hemlock
#

not that i know

#

but you can google it

orchid hemlock
pine bane
#

and do make it smooth you can lerp it

orchid hemlock
#

sure why not