0
COMPLETADO
would it be possible to have a player and/or ai position via an object input node?
it would be super great to have the location of the player or an AI as data in a shader. In a few scripting tools I've used there's an object node that allows you to drop a target object from the scene. That info could be awesome to do stuff like bending grass when a player walks over it.
Respuesta
0
Respuesta
COMPLETADO
Freya Holmér (Developer) hace 11 años
Lionel Gallat answered this below :)
Joachim showed me that you can already do that: just create a "PlayerPos" Vector4 property in your shader and then create a script (which you'll put on the transform with the mesh/material). That script will feed the player position to the shader in an Update function like so:
objectMeshWithTheShader.renderer.material.SetVector("_PlayerPos", playerTransform.position);
That being said if there could be a way of directly accessing a transform node (drag and drop the node the same way you can a texture asset) and have access to its Position, Rotation and Scale that would be great. But again I'm not entirely sure that would be feasible or even if it's a good idea...
objectMeshWithTheShader.renderer.material.SetVector("_PlayerPos", playerTransform.position);
That being said if there could be a way of directly accessing a transform node (drag and drop the node the same way you can a texture asset) and have access to its Position, Rotation and Scale that would be great. But again I'm not entirely sure that would be feasible or even if it's a good idea...
Thanks for the info Lionel. I was thinking the same thing, but that sounds crazy at the same time. But I guess it's not that crazy after all! :) I'll give that a go. Hopefully it will work if my mesh is being used on a terrain.
thanks again!
thanks again!
Servicio de atención al cliente por UserEcho