Kill Sphere position has an offset position when binding to a normal sphere

Hello everyone,

I’m trying to make a VFX Graph system where you can erase the particles with the mouse (or swipe for a touch screen) using the kill sphere block.

I’m spawning my particles using a SDF and I attached a binder to the kill sphere so i can control the position with a normal sphere created in the editor.

My system works pretty much as desired except because for some reason, there seems to be an offset on the Y coordinates so every time you try to erase the particles, you wont do it and you need to erase on the lower area to compensate the offset and its driving me nuts because I have no idea whats going on.

I have tried to modify directly the variable inside the VFX Graph and also the position of my sphere in the editor with no luck.

I’m not sure if the SDF has something to do with this because the Kill Sphere appears at the center (pivot point of the SDF)

I also noticed I can’t debug in real time the kill sphere, as every time i move the normal sphere, the kill sphere gizmo doesn’t move although the particles does get erased.

Any help will be appreciated.

Here’s my script controlling the sphere position, the offset is to allow the sphere to interact with my system instead of spawning directly at the camera, thast why the offset is at Z:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class MouseEraser : MonoBehaviour
{
    public GameObject eraser;
    public float offset = 3.0f;

    void Update()
    {
        Vector3 pos = Input.mousePosition;
        pos.z = offset;

        eraser.GetComponent<Transform>().position = Camera.main.ScreenToWorldPoint(pos);
    }




Notice the eraser property inside the graph (so kill sphere too) has L, means it takes position in local space, while you probably feed it with world space position.
Also additional sidenote - do not use GetComponent every frame, just cache transform in variable in awake/start, but in this case you can simply do eraser.transform.position or even better just make eraser Transform reference instead of GameObject.

Oh, that was well spotted!

The World Space Position did solve my problem, I also did changed the way I gather the position from the sphere, thank you very much for your tips!.