Create Particles on a pseudo-2D surface

Hi

I have a 3D scene and use Camera.main.ScreenToWorldPoint(Input.mousePosition) to find out where to put the particle I want to instantiate. But this doesnt take into account the angle of my camera.

What I want to achieve is that the mouse trail that the user drew is made visible via particles. But it shouldn’t look like they were in a 3D scene but rather as if this trail was 2D flat on the user’s screen. So let’s say my camera is looking at the scene in a 60° x-angle with a 25 field of view. Normal instantiations make the objects on higher y positions bigger than the ones at lower y positions.
Any pointers to this topic would help

oh yeah and my prefab will always be instantiated on the same position, no matter where exactly i clicked

thx!

Instead of using the point returned from Camera.main.ScreenToWorldPoint(Input.mousePosition) directly you could do something like this:

  1. Get the vector from this point to the camera ( InstantationPoint - CameraPosition)

  2. Normalize this vector

  3. Multiply it by a set distance from the camera (e.g. 10 metres)

  4. Add the camera position to it

The point you now have will always be 10 metres from the camera but in the direction that you clicked.

1 Like

so with 1) you mean get the point in the real 3D scene that I clicked on?

Your solutions makes sense to me, I will try it out asap.

But nevertheless: mine cant be the right approach if I want to display the created trace only to the player screen without being rendered in the world, right? Moreover I think that lighting will interfere with those particles. I recently found the LineRenderer. Is that maybe more suited?
Basically, I want to redraw the player’s gesture and make it a little bit more beautiful.

This isn’t really working for taking the gesture via Input.mousePosition.
It is somehow so tilted and close together that I can’t even see a pattern. Maybe it wasn’t clear that I actually want to grab Input.mousePosition instead of some 3D coordinate. Somehow I thought wrong I guess

Vector3 camPos = Camera.main.transform.position;
Vector3 subtracted = Input.mousePosition - camPos;
Vector3 normalizedPoint = Vector3.Normalize(subtracted);
normalizedPoint *= 3;
normalizedPoint += camPos;
GameObject go = (GameObject)Instantiate(visualization, normalizedPoint, Quaternion.identity);

How can I make subtracted the real vector? We can even assume that the camera position is fixed at a vector vcam if that helps.