17-12-2019, 04:21 PM
(This post was last modified: 17-12-2019, 04:23 PM by josemendez.)
(17-12-2019, 04:03 PM)Duncano Wrote: thanks very much, easy if you know how...unfortunately i dont know how....my scripting knowledge is based on using other peoples scripts and adapting what i can...i tried doing something with the code above, no luck. If such a script already exists, i would be grateful if i could just drag it on to the objects i want to move.
Hi,
Simply create a new C#, copy and paste the code above. Replace the "<your force here>" with the force you want to apply, that's it. Here's the full copy-pastable code, made the force a public variable for convenience, so that you can change it in the editor:
Code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Obi;
public class Force : MonoBehaviour
{
public ObiSoftbody softbody;
public Vector3 force;
public void FixedUpdate()
{
softbody.AddForce(force,ForceMode.Force);
}
}
If you're aiming to develop games (or any program for that matter), learning how to code is a must, or at the very least having a programmer in the team who can do the job. You just can't rely on copy-pasting code you don't fully understand.