|
Post by archieandrews on Jul 14, 2019 15:40:15 GMT
I can never get my head around how to access the Invector Controls I'd appreciate an end to end example.
Can someone please explain in this snippet of code and tell me EXACTLY what goes where to enable me to change camera states via C# when it starts?
Please dont send em to the demos they make little sense to me and I'm NOT using a trigger so I cannot work from the demo example.
I need to know specifically by example to access Invector and change the camera state.
I also want it to Lerp
Many thanks ....
EXAMPLE:
using System.Collections; using System.Collections.Generic; using UnityEngine;
using Invector .. blab la what do I need put HERE?
public class TestInvector : MonoBehaviour {
WHAT DO I NEED TO PUT HERE ???
// Use this for initialization void Start () { WHAT DO I PUT HERE TO CHANGE CAMERA STATE ? (I can assign if logic later in Update I just need to know the basic call syntax } // Update is called once per frame void Update () { } }
|
|
|
Post by shadex on Jul 14, 2019 17:48:26 GMT
I can never get my head around how to access the Invector Controls I'd appreciate an end to end example.
Can someone please explain in this snippet of code and tell me EXACTLY what goes where to enable me to change camera states via C# when it starts?
Please dont send em to the demos they make little sense to me and I'm NOT using a trigger so I cannot work from the demo example.
I need to know specifically by example to access Invector and change the camera state.
I also want it to Lerp
Many thanks ....
EXAMPLE:
using System.Collections; using System.Collections.Generic; using UnityEngine;
using Invector .. blab la what do I need put HERE?
public class TestInvector : MonoBehaviour {
WHAT DO I NEED TO PUT HERE ???
// Use this for initialization void Start () { WHAT DO I PUT HERE TO CHANGE CAMERA STATE ? (I can assign if logic later in Update I just need to know the basic call syntax } // Update is called once per frame void Update () { } }
Not at my computer, but from memory it should be as follows.
EXAMPLE: using System.Collections; using System.Collections.Generic; using UnityEngine; using Invector.vCamera; <--- USE THIS
using Invector .. blab la what do I need put HERE? public class TestInvector : MonoBehaviour { public vThirdPersonCamera TPCamera; // Use this for initialization void Start () { //State name is a string, and "True" is to allow smoothing, which should get you your Lerp action. TPCamera.ChangeState("StateName", true); } // Update is called once per frame void Update () { } }
|
|
|
Post by archieandrews on Jul 14, 2019 18:21:23 GMT
Produces error:
NullReferenceException: Object reference not set to an instance of an object Invector.vCamera.vThirdPersonCamera.ChangeState (System.String stateName, Boolean hasSmooth) (at Assets/Invector-3rdPersonController/Basic Locomotion/Scripts/Camera/vThirdPersonCamera.cs:238) TestInvector.Start () (at Assets/Scenes/TestInvector.cs:13)
Simple enough code .. but utterly crap documentation on this product.
I added my 3rd perosn cam to the public object
Any ideas?
TY
using System.Collections; using System.Collections.Generic; using UnityEngine;
using Invector.vCamera;
public class TestInvector : MonoBehaviour {
public vThirdPersonCamera TPCamera;
// Use this for initialization void Start () { TPCamera.ChangeState("Talking", true); } // Update is called once per frame void Update () { } }
|
|
|
Post by shadex on Jul 14, 2019 19:45:42 GMT
Produces error:
NullReferenceException: Object reference not set to an instance of an object Invector.vCamera.vThirdPersonCamera.ChangeState (System.String stateName, Boolean hasSmooth) (at Assets/Invector-3rdPersonController/Basic Locomotion/Scripts/Camera/vThirdPersonCamera.cs:238) TestInvector.Start () (at Assets/Scenes/TestInvector.cs:13)
Simple enough code .. but utterly crap documentation on this product.
I added my 3rd perosn cam to the public object
Any ideas?
TY
using System.Collections; using System.Collections.Generic; using UnityEngine;
using Invector.vCamera;
public class TestInvector : MonoBehaviour {
public vThirdPersonCamera TPCamera;
// Use this for initialization void Start () { TPCamera.ChangeState("Talking", true); } // Update is called once per frame void Update () { } }
Yea, not going to help you anymore kid, due to your shit talking in other threads, and the fact that you don't know what a null reference is. I'm fine with basic stupid questions like this, but not if your going to be an ungrateful. Especially if your not competent enough to read the API or the documentation.
|
|
|
Post by archieandrews on Jul 14, 2019 19:53:29 GMT
Fair comment .. my apology .. just having a rough time trying to do too many roles.
Thanks anyways
|
|
|
Post by shadex on Jul 14, 2019 20:14:21 GMT
Fair comment .. my apology .. just having a rough time trying to do too many roles.
Thanks anyways
The ungratefulness pisses me off to no end. As someone who's made and supported free system for everyone, then to get shit on make's it a waste of time to return to these forums and answer questions like these, that provide zero benefit to me. The direct result is your questions don't get answered.
Anyways, you have to drag the camera into the reference for TPCamera on the script, once you attach the script to a gameobject
|
|
|
Post by archieandrews on Jul 14, 2019 20:37:56 GMT
Dude Like I said I am am sorry man TRUST me I do a thankless job myself for mining heritage myself at times .. I'm working on massive projects / ideas to please a lot of ungrateful arseholes.
My stress boiled over LOL ..
Thanks anyways ;-)
|
|
|
Post by Invector on Jul 15, 2019 15:42:12 GMT
No need to access the camera, you can do it directly with the tpInput using the method ChangeCameraState Here's an example for you:
using Invector.vCharacterController; using System.Collections; using System.Collections.Generic; using UnityEngine;
public class CameraStateChangeExample : MonoBehaviour { public vThirdPersonInput tpInput;
void Start () { // automatically grabs the tpInput if not assigned, and if this component is in the Player if (tpInput == null) tpInput = GetComponent<vThirdPersonInput>(); } void Update () { if(Input.GetKeyDown(KeyCode.Y)) //applies a custom camera state tpInput.ChangeCameraState("YourState");
if (Input.GetKeyDown(KeyCode.H)) //back to default camera state tpInput.ResetCameraState(); } }
|
|
|
Post by Invector on Jul 15, 2019 15:43:06 GMT
It's a fairly new method that we added recently on the latest update (not sure what version now), so if you're using an older version it may not come up
|
|
|
Post by archieandrews on Jul 16, 2019 11:37:58 GMT
Thank you Invector !
|
|
|
Post by camperjohn on Mar 25, 2020 13:23:19 GMT
THANK YOU Invector Admin, your post above was exactly what I was looking for. I could not get it to work, looked at your code, and it all became clear. Thanks again from a very novice programmer.
|
|