I’ve gotten tired of using the invector Third Person Controller for making my game because I’m unable to access the speed varibles from the script to modify in another script for boost panels and such, so I’d like some help to make a platformer character script (Third Person controller except the player moves freely instead of strafing)
To add on, I dont want root motion as it messes with the character i’m using
Well I’m trying to make a sonic character controller (well a normal platformer controller but the speed varibles can be changed), but every controller i’ve used either doesnt work with my character, is too old to work, or just wont let me access the speed varibles at all (Invector has the speed varibles in another class and I have no idea how to access them to modfiy my character’s max speed temporally)
For my invector problem, this is whats going on
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Invector.vCharacterController;
public class SonicModifier : MonoBehaviour
{
public vThirdPersonController PlayerController;
float fixedRunSpeed;
float fixedAirSpeed;
public int Multiply;
// Start is called before the first frame update
void Start()
{
PlayerController = gameObject.GetComponent(typeof(vThirdPersonController)) as vThirdPersonController;
fixedAirSpeed = PlayerController.airSpeed;
fixedRunSpeed = PlayerController.vMovementSpeed.runningSpeed;
}
// Update is called once per frame
void Update()
{
}
}
and the error Assets\Michael's Assets\Scripts\SonicModifier.cs(20,42): error CS0572: 'vMovementSpeed': cannot reference a type through an expression; try 'vThirdPersonMotor.vMovementSpeed' instead
along with this too Assets\Michael's Assets\Scripts\SonicModifier.cs(20,25): error CS0120: An object reference is required for the non-static field, method, or property 'vThirdPersonMotor.vMovementSpeed.runningSpeed'
And because of this, I’m wanting to give up with Invector and just make my own script, but the problem is getting the player to move reletive to the camera, without rotating them towards where the camera is looking
Haven’t used invector. Your error messages indicate that vMovementSpeed is not a property of a PlayerContrller, but a type or a nested class. That’s why you can’t access runningSpeed. Refer t the documentation and see proper way to access it. Judging by the piece of code you provided, Invector package uses a non-standard naming convention where types start with lovercase v letter. See if there’s PlayerController.groundSpeed or something similar.
I’ll also mention that the problem is that there’s multiple scripts for this, and they are all combined into one
vThirdPersonMotor is where all the movement data is stored
vThirdPersonController is the main script, and it’s a child of vThirdPersonAnimator, which is also a child of vThirdPersonMotor, and i have no idea how to access that far back when the main script is vThirdPersonController
vThirdPersonAnimator has the varible i need exposed outside of the class however
The vMovementSpeed isnt in the controller, its in the motor script.
The controller script is the script that needs putting on a gameobject to make it work