Skip to main content
Bumped by Community user
added 12 characters in body
Source Link

This code is for controlling a shark

I want to have continuous collision detection which won't work with MovePosition so I tried changing it other options but those are making the Shark Fly

Why does converting this line

Rb.MovePosition(transform.position + SharkCamera.transform.forward * CurrentSpeed * Time.fixedDeltaTime);

to this

Rb.velocity += SharkCamera.transform.forward * CurrentSpeed * Time.fixedDeltaTime; 

or this

Rb.AddForce(-transform.right * CurrentSpeed * Time.fixedDeltaTime, ForceMode.VelocityChange);

makes the Shark fly?

Note: Directly setting the velocity won't work because other forces are acting too

This code is for controlling a shark

I want to have continuous collision detection which won't work with MovePosition so I tried changing it other options but those are making the Shark Fly

Why does converting this line

Rb.MovePosition(transform.position + SharkCamera.transform.forward * CurrentSpeed * Time.fixedDeltaTime);

to this

Rb.velocity += SharkCamera.transform.forward * CurrentSpeed * Time.fixedDeltaTime; 

or this

Rb.AddForce(-transform.right * CurrentSpeed * Time.fixedDeltaTime, ForceMode.VelocityChange);

makes the Shark fly?

Note: Directly velocity won't work because other forces are acting too

This code is for controlling a shark

I want to have continuous collision detection which won't work with MovePosition so I tried changing it other options but those are making the Shark Fly

Why does converting this line

Rb.MovePosition(transform.position + SharkCamera.transform.forward * CurrentSpeed * Time.fixedDeltaTime);

to this

Rb.velocity += SharkCamera.transform.forward * CurrentSpeed * Time.fixedDeltaTime; 

or this

Rb.AddForce(-transform.right * CurrentSpeed * Time.fixedDeltaTime, ForceMode.VelocityChange);

makes the Shark fly?

Note: Directly setting the velocity won't work because other forces are acting too

added 74 characters in body
Source Link

This code is for controlling a shark

I want to have continuous collision detection which won't work with MovePosition so I tried changing it other options but those are making the Shark Fly

Why does converting this line

Rb.MovePosition(transform.position + SharkCamera.transform.forward * CurrentSpeed * Time.fixedDeltaTime);

to this

Rb.velocity += SharkCamera.transform.forward * CurrentSpeed * Time.fixedDeltaTime; 

or this

Rb.AddForce(-transform.right * CurrentSpeed * Time.fixedDeltaTime, ForceMode.VelocityChange);

makes the Shark fly?

Note: Directly velocity won't work because other forces are acting too

This code is for controlling a shark

I want to have continuous collision detection which won't work with MovePosition so I tried changing it other options but those are making the Shark Fly

Why does converting this line

Rb.MovePosition(transform.position + SharkCamera.transform.forward * CurrentSpeed * Time.fixedDeltaTime);

to this

Rb.velocity += SharkCamera.transform.forward * CurrentSpeed * Time.fixedDeltaTime; 

or this

Rb.AddForce(-transform.right * CurrentSpeed * Time.fixedDeltaTime, ForceMode.VelocityChange);

makes the Shark fly?

This code is for controlling a shark

I want to have continuous collision detection which won't work with MovePosition so I tried changing it other options but those are making the Shark Fly

Why does converting this line

Rb.MovePosition(transform.position + SharkCamera.transform.forward * CurrentSpeed * Time.fixedDeltaTime);

to this

Rb.velocity += SharkCamera.transform.forward * CurrentSpeed * Time.fixedDeltaTime; 

or this

Rb.AddForce(-transform.right * CurrentSpeed * Time.fixedDeltaTime, ForceMode.VelocityChange);

makes the Shark fly?

Note: Directly velocity won't work because other forces are acting too

added 1 character in body
Source Link

This code is for controlling a shark

I want to have continuous collision detection which won't work with MovePosition so I tried changing it other options but those are making the Shark Fly

Why does converting this line

Rb.MovePosition(transform.position + SharkCamera.transform.forward * CurrentSpeed * Time.fixedDeltaTime);

to this

Rb.velocity += SharkCamera.transform.forward * CurrentSpeed * Time.fixedDeltaTime; 

or this

Rb.AddForce(-transform.right * CurrentSpeed * Time.fixedDeltaTime, ForceMode.VelocityChange);

makes mythe Shark fly?

This code is for controlling a shark

I want to have continuous collision detection which won't work with MovePosition so I tried changing it other options but those are making the Shark Fly

Why does converting this line

Rb.MovePosition(transform.position + SharkCamera.transform.forward * CurrentSpeed * Time.fixedDeltaTime);

to this

Rb.velocity += SharkCamera.transform.forward * CurrentSpeed * Time.fixedDeltaTime; 

or this

Rb.AddForce(-transform.right * CurrentSpeed * Time.fixedDeltaTime, ForceMode.VelocityChange);

makes my Shark fly?

This code is for controlling a shark

I want to have continuous collision detection which won't work with MovePosition so I tried changing it other options but those are making the Shark Fly

Why does converting this line

Rb.MovePosition(transform.position + SharkCamera.transform.forward * CurrentSpeed * Time.fixedDeltaTime);

to this

Rb.velocity += SharkCamera.transform.forward * CurrentSpeed * Time.fixedDeltaTime; 

or this

Rb.AddForce(-transform.right * CurrentSpeed * Time.fixedDeltaTime, ForceMode.VelocityChange);

makes the Shark fly?

added 1 character in body
Source Link
Loading
Source Link
Loading