Quantcast
Channel: Questions in topic: "error message"
Viewing all articles
Browse latest Browse all 2891

i have some code for Faux Gravity that doesn't work as intended.

$
0
0
using System.Collections; using System.Collections.Generic; using UnityEngine; public class Attractor : MonoBehaviour { public float gravity = -10; public void Attract(Transform body) { Vector3 gravityUp = body.position = transform.position.normalized; Vector3 bodyUp = body.up; body.rigidbody.AddForce(gravityUp * gravity); // error here Quaternion targetRotation = Quaternion.FromToRotation(bodyUp, gravityUp) * body.rotation; body.rotation = Quaternion.Slerp(body.rotation = targetRotation, 50 * Time.deltaTime); // error above } } is there a way to fix these errors?

Viewing all articles
Browse latest Browse all 2891

Trending Articles