Need to know the meaning of the function "getInputVector"

Recommended Posts

Hello.

I was searching the signification of the method getInputVector(). I've found it in Entity.java

```private static Vec3 getInputVector(Vec3 pRelative, float pMotionScaler, float pFacing) {
double d0 = pRelative.lengthSqr();
if (d0 < 1.0E-7D) {
return Vec3.ZERO;
} else {
Vec3 vec3 = (d0 > 1.0D ? pRelative.normalize() : pRelative).scale((double)pMotionScaler);
float f = Mth.sin(pFacing * ((float)Math.PI / 180F));
float f1 = Mth.cos(pFacing * ((float)Math.PI / 180F));
return new Vec3(vec3.x * (double)f1 - vec3.z * (double)f, vec3.y, vec3.z * (double)f1 + vec3.x * (double)f);
}
}```

Here is another function which uses the getInputVector :

```public void moveRelative(float pAmount, Vec3 pRelative) {
Vec3 vec3 = getInputVector(pRelative, pAmount, this.getYRot());
}```

Could someone explain me what is the goal of this method please ?

Share on other sites

12 hours ago, Vat1n said:

Could someone explain me what is the goal of this method please ?

To set the movement of the entity towards the direction of the passed in vector.

Share on other sites

Thank you for your answer. I understand now : Imagine you want to move diagonally (in relation to the axes X and Z), you have to set X movement and Z movement. Then we'll have to deal with Pythagorean theorem or something like that in order to get the correct value for the diagonal movement 😄

Edited by Vat1n

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.

×   Pasted as rich text.   Restore formatting

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×

• Posts

• 🚀OPALTOGEL Situs Togel Online Terpercaya Pasti Bayar Lunas OPALTOGEL adalah platform terbaik togel online terpercaya menang berapapun pasti bayar dan dengan bermain bersama Opal Togel Terpercaya pastinya tidak akan ada rasa ragu lagi ketika mendapatkan kesempatan menang besar angka 4D. ========================== Informasi OpalTogel Terpercaya ========================== Nama Situs: 🚀OPALTOGEL🚀 Jenis Permainan: 🎲Togel Online, 🎰Slot Online, 💸Live Casino Online, 🐓Sambung Ayam Minimal Deposit: 💵Rp 10.000 Metode Deposit: 🟢Transfer Bank, 🔵E-Wallet, 🟠Pulsa, ⚪️Qris Mata Uang: 💰IDR (Indonesian Rupiah) Jam Operasional: 🕧24 Jam Online Rating: ⭐⭐⭐⭐⭐ 9,926,207 Pemain Keywords Terkait : 🚀opaltogel 🚀opal togel 🚀opaltogel login 🚀opaltogel alternatif 🚀link opaltogel 🚀bo opaltogel 🚀togel online 🚀situs togel terpercaya
• Pakistani Call 'Girls in Motor City 0525373611 Call 'Girls in Motor City By Dubai E'scorts, E'scorts in Dubai Pakistani Call 'Girls in Motor City 0525373611 Call 'Girls in Motor City By Dubai E'scorts, E'scorts in Dubai Pakistani Call 'Girls in Motor City 0525373611 Call 'Girls in Motor City By Dubai E'scorts, E'scorts in Dubai Pakistani Call 'Girls in Motor City 0525373611 Call 'Girls in Motor City By Dubai E'scorts, E'scorts in Dubai Pakistani Call 'Girls in Motor City 0525373611 Call 'Girls in Motor City By Dubai E'scorts, E'scorts in Dubai Pakistani Call 'Girls in Motor City 0525373611 Call 'Girls in Motor City By Dubai E'scorts, E'scorts in Dubai
• Pakistani Call 'Girls in Sports City 0525382202 Call 'Girls in Sports City By Dubai E'scorts, E'scorts in Dubai Pakistani Call 'Girls in Sports City 0525382202 Call 'Girls in Sports City By Dubai E'scorts, E'scorts in Dubai Pakistani Call 'Girls in Sports City 0525382202 Call 'Girls in Sports City By Dubai E'scorts, E'scorts in Dubai Pakistani Call 'Girls in Sports City 0525382202 Call 'Girls in Sports City By Dubai E'scorts, E'scorts in Dubai Pakistani Call 'Girls in Sports City 0525382202 Call 'Girls in Sports City By Dubai E'scorts, E'scorts in Dubai Pakistani Call 'Girls in Sports City 0525382202 Call 'Girls in Sports City By Dubai E'scorts, E'scorts in Dubai Pakistani Call 'Girls in Sports City 0525382202 Call 'Girls in Sports City By Dubai E'scorts, E'scorts in Dubai

• Who's Online (See full list)

×

• Activity

×
• Create New...