Help Creating New Interactions

TruAmbition

New member
Greetings All,

I've been battling this for the past couple days and figured I'd at least put a line out to see if someone would be willing to assist. I am building a game where the player walks around and completes simple objectives. Most of these objectives are simple animations that play when trigger is set. To my understanding, this aspect of interaction would require me to use the logic for "New objects" outlined in the interact API section, am I correct? I was hoping someone would be willing to do a video doing a base project that implements a custom interaction activating a simple animation via trigger or bool using the Opsive controller. I currently have the 3rd person controller and agility pack. Is it as simple as :


Code:
public class truinteract : MonoBehaviour, IInteractableTarget {

 
        public bool CanInteract(GameObject character)
        {
            return true;
        }

        public void Interact(GameObject character)
        {
            Debug.Log("Has Interacted");
        }
}

and applying this to each component where interactions need to take place? I fear I'm overthinking this as I didn't see similar questions in the forum.

Please advise,
 

Attachments

  • Screen Shot 2019-05-14 at 7.46.36 PM.png
    Screen Shot 2019-05-14 at 7.46.36 PM.png
    293.6 KB · Views: 33
The script that you posted is a valid interaction target. On the Interactable component you'll then need to assign it to the Targets field. If you haven't seen it this page describes how I setup the interact ability so when you press a button it moves a platform:

 
The script that you posted is a valid interaction target. On the Interactable component you'll then need to assign it to the Targets field. If you haven't seen it this page describes how I setup the interact ability so when you press a button it moves a platform:



Meaning I need to assign that TruInteract script I wrote directly to the Targets array? It doesn't add the script wether it's on the game object or not. I'm still not making the connection, the link you sent me is the link i've been reading over and over and still not understanding. The way my component is configured right now I get this error at runtime:

"Error: element 0 of the Targets array is null or does not subscribe to the IInteractableTarget iterface."

I'm pretty sure this is the block in my gears, this will prevent even the interaction display from showing up as the error triggers on the intractable script.


Please advise,


1274

Opening inspector components:
1275
 
Based on your screenshot it looks like you have set element 0 to CommSattAttnMain which doesn't implement IInteractableTarget. Should that element be Truinteract instead?
 
Top