I have an angle and I want to add force in that direction. It is a 2d game here is the code for the script:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerController : MonoBehaviour
{
public float movementSpeed = 3.0f;
float movement = new float();
public float shootdirection;
public float recoildirection;
public Vector2 flydirection;
Rigidbody2D rb2D;
private void Start()
{
rb2D = GetComponent<Rigidbody2D>();
}
private void Update()
{
}
private void FixedUpdate()
{
setvalues();
}
void setvalues()
{
shootdirection = GameObject.Find("Arrow").GetComponent<PointerController>().z_rotation;
recoildirection = GameObject.Find("Arrow").GetComponent<PointerController>().thrustdirection;
}
void blast()
{
}
}