#help me

1 messages · Page 1 of 1 (latest)

north jackal
mellow acorn
#

Where's point 4?

#

Also, you're using translate wrong. Have a read of the function in the docs. Specifically what it does and how the parameter that it takes affect it.

north jackal
#

it is a vector3

north jackal
#

I have also used transform.translate before but it was all using a normalized vector

mellow acorn
#

Do you understand the difference between position and direction?

north jackal
#

but why can't the vector 3 be a direction?

#

or should I use rb.MovePosition();
@mellow acorn

#

it does move to the point in my other experiences

#

or maybe you can tell me what's wrong and how to fix it

mellow acorn
#

Position is also a direction. A direction from the world origin to the target position.

placid flame
#

So translate is moving towards direction. what you want is just change position and use something like
transform.position = Vector3.Lerp()

north jackal
placid flame
#

Lerp changes position from one to another smoothly

north jackal
placid flame
#

you will see it moving smoothly. Lerp is linear transformation, also there are slerp and etc

north jackal
#

like transform.Translate(transform * speed * Time.deltaTime);

placid flame
north jackal
placid flame
#

Lerp does eactly what you want.

north jackal
#

that's why I added * Time.deltaTime

north jackal
placid flame
#
transform.position = Vector3.Lerp(startMarker.position, endMarker.position, fractionOfJourney);
#

this example eplains it best. you give start position, end position, and time in which you want that object to reach the final position. so it will not be teleportation.

north jackal
honest rune
#

What are you actually trying to do? Move towards another position at a speed?

honest rune
#

Then use MoveTowards

#
transform.position = Vector3.MoveTowards(transform.position, targetPosition, Time.deltaTime * maxSpeed);