Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

349
Views
Spark AR Studio, plane tracker get vector target position based on target rotation

I am trying to create parabola logic for Spark AR studio using only javascript (without patches)

there is a limitation to my project

  1. No world/local transform patches/code
  2. Patches only used for sent vector3 position and rotation to script

Okay, I have 1 parent object with 1 child.

object inspector

  • Ball for control rotation and position
  • Fussball.001 only adds position z vector to make the ball in front of the player's foot

ball and Fussball differences

My goal is I want to kick the ball to the target based on the rotation of Ball, for example, the ball position is 0,0,0, and ball rotation is 0,45,0, so the ball target is -0.51721, 0, -0.51721 it's just example, here's simulation if I do it in spark ar viewport

example in viewport

I know I can create easily with getting object global transform, but the problem is global transform is sucks if I use inside plane tracker. for now my script only like this, just get the vector position and rotation only and send it to patches

  var target_position = null;

  target_position = [0, 0, 0];

  const [x, y, z, rotationY] = await Promise.all([
    Patches.outputs.getScalar("x"),
    Patches.outputs.getScalar("y"),
    Patches.outputs.getScalar("z"),
    Patches.outputs.getScalar("rotationY"),
  ]);

  x.monitor().subscribe(() => {
    target_position[0] = x.pinLastValue();
  });

  y.monitor().subscribe(() => {
    target_position[1] = y.pinLastValue();
  });

  z.monitor().subscribe(() => {
    target_position[2] = z.pinLastValue();
    Time.setTimeout(() => {
      Patches.inputs.setVector(
        "ball_shooting_target_position_sender",
        Reactive.vector(
          target_position[0],
          target_position[1],
          target_position[2]
        )
      );
    }, 50);
  });

  rotationY.monitor().subscribe(() => {
    Diagnostics.log(rotationY.pinLastValue());
  });

I think this case is similar with web-based javascript game, but i don't know the correct keyword to search it through google. Thanks

about 4 years ago · Santiago Gelvez
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!