Forum rules - please read before posting.

Action Physics Raycast

Hi,

I have a strange thing happening when using the Physics:Raycast Action. It's used in a bit more complicated manner, but the result is the same so if I do the following in a First Person game:
1. Add a cube, assign hotspot with Action List Asset Action
2. Assign the Use:action from the attached figure (From Origin Forward). Origin is a Marker ("SleepingBag Raycast") that is placed as a child object of the First Person Player prefab.
-> The action goes directly to "If no object detected" and there is no red line to show that a ray has been cast.

Then:

  • Change the action to "To Set Destination", assigning the cube as the destination
    -> A red ray is cast from the Marker to the Cube and I get the "If object detected result"

Then

  • Change back to "From origin forward"
    -> A red ray is cast to the cube as if the setting was still "To Set Destination".

Then:

  • Open another scene, then open the original scene again
    -> A red ray is cast as "From origin forward" as it should

Then:

  • Close Unity, open Unity back up. The result is now back to the start with no red ray being cast and "If no object detected" action.

What am I missing?

Unity: 2021.3.8f1
AC: 1.80.5

https://imgur.com/a/3mTJ2ak

// Magnus

Comments

  • A bug, most likely.

    Open up AC's ActionRaycast script, and look for the following around line 100:

    if (directionMode == DirectionMode.ToSetDestination)
    {
        runtimeDestinationTransform = AssignFile (parameters, destinationTransformParameterID, destinationTransformConstantID, destinationTransform);
    }
    

    Just under, add:

    else runtimeDestinationTransform = null;
    

    Does that resolve it?

  • Hi Chris,

    No unfortunately not. It's still like the top case, where no ray is cast.

  • A little further up, there should be:

    distance = AssignFloat (parameters, distanceParameterID, distance);
    

    Replace with:

    runtimeDistance = AssignFloat (parameters, distanceParameterID, distance);
    
  • Yes, works perfect. Thanks a lot!!

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.