please check my approach for intergrate edy vehicle physics
May 27, 2019 16:02:25 GMT
Invector, uberwiggett, and 2 more like this
Post by ozymandiaz on May 27, 2019 16:02:25 GMT
please check my approach for intergrate edy vehicle physics with tps on top-down shooter.
i working now third person shooter with vehicle system referenced by vLadderAction.
and i use edy vehicle physics.
i follow step below:
1. in player's animator controller, create new sub-state machine named by 'Driving' under base layer->actions.
2. add driving animation and add vAnimatorTag component.
3. connect transition between driving animation and exit node.
4. add transition condition to ActionState Equals 0.
5. create script named by 'DrivingHelper.cs' and add to Player.(code under thread.)
6. make vehicle and setup interaction collider.
7. add vTriggerGenericAction component into interaction collider.
7.1. in Animation tab, Set Play Animation to 'Driving'.
7.2. in Animation tab, Set Animator Action State to 1.
7.3. in Events tab, add DoDriving Event to OnPressActionInput.
if you see my video. it seems to be works fine.
but, i want to know, is this correct approach for vehicle system intergrate into third person shooter?
best regards.
i working now third person shooter with vehicle system referenced by vLadderAction.
and i use edy vehicle physics.
i follow step below:
1. in player's animator controller, create new sub-state machine named by 'Driving' under base layer->actions.
2. add driving animation and add vAnimatorTag component.
3. connect transition between driving animation and exit node.
4. add transition condition to ActionState Equals 0.
5. create script named by 'DrivingHelper.cs' and add to Player.(code under thread.)
6. make vehicle and setup interaction collider.
7. add vTriggerGenericAction component into interaction collider.
7.1. in Animation tab, Set Play Animation to 'Driving'.
7.2. in Animation tab, Set Animator Action State to 1.
7.3. in Events tab, add DoDriving Event to OnPressActionInput.
if you see my video. it seems to be works fine.
but, i want to know, is this correct approach for vehicle system intergrate into third person shooter?
best regards.
using UnityEngine;
using System.Collections;
using Invector.vCharacterController;
using Invector.vCharacterController.TopDownShooter;
using Invector.vCharacterController.vActions;
using EVP;
public class DrivingHelper : MonoBehaviour
{
public GenericInput exitDrivingInput;
private vTopDownShooterInput tpInput;
private vTriggerGenericAction targetAction;
private VehicleStandardInput vehicleInput;
private VehicleProperty vehicleProp;
private bool isDriving = false;
private void Awake()
{
tpInput = GetComponent<vTopDownShooterInput>();
}
private void OnAnimatorMove()
{
if(vehicleProp != null )
{
transform.position = vehicleProp.seatLocation.position;
transform.rotation = vehicleProp.seatLocation.rotation;
}
}
public void DoDriving(vTriggerGenericAction targetAction)
{
vehicleInput = targetAction.GetComponentInParent<VehicleStandardInput>();
vehicleProp = targetAction.GetComponentInParent<VehicleProperty>();
tpInput.enabled = false;
tpInput.cc.enabled = false;
tpInput.cc.DisableGravityAndCollision();
tpInput.cc._rigidbody.velocity = Vector3.zero;
tpInput.cc.isGrounded = false;
tpInput.cc.animator.SetBool("IsGrounded", false);
vehicleInput.enabled = true;
isDriving = true;
}
private void Update()
{
if(isDriving && exitDrivingInput.GetButtonDown())
{
ExitDriving();
}
}
public void ExitDriving()
{
vehicleInput.enabled = false;
transform.position = vehicleProp.exitLocation.position;
transform.rotation = vehicleProp.exitLocation.rotation;
tpInput.cc.animator.SetInteger("ActionState", 0);
tpInput.cc._rigidbody.velocity = Vector3.zero;
tpInput.cc.EnableGravityAndCollision(0.0f);
tpInput.cc.enabled = true;
tpInput.enabled = true;
vehicleInput = null;
vehicleProp = null;
isDriving = false;
}
}
using UnityEngine;
using System.Collections;
public class VehicleProperty : MonoBehaviour
{
public Transform seatLocation;
public Transform exitLocation;
}