Search Unity

Raycast from IAnimationJob.ProcessAnimation()

Discussion in 'Animation' started by littlepolygon, Dec 2, 2019.

  1. littlepolygon

    littlepolygon

    Joined:
    Jul 7, 2013
    Posts:
    16
    (Hopefully this isn't bad-form, but I posted to scripting originally, but now it seems like that wasn't the correct category?)

    I'm trying to write an animation job that performs foot-fixup against terrain as part of a PlayableGraph. However, both Physics.Raycast() and RaycastCommand.ScheduleBatch() complain about not being on the main thread.

    Point of clarification: the foot location that we're querying-from is coming from an AnimationStream input -- our job adjusts the incoming intermediate pose with ik -- so the position isn't known before the playable-graph kicks-off evaluation.

    What's the correct way to raycast from the playable thread? If not, is there a way to synchronize with the main thread? Or else, what's the best place to request support, since this would be a high-value feature.

    For reference, here's the log from attempting to raycast through the job system.