Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Is there a way to deform a gameobject?
#1
Like in this video, is there a way to deform a gameobject similar to deform mesh? Trying to curve the mesh.
https://youtu.be/eP6QEn9SFoM
Reply
#2
Yes, using the GameObject To Mesh module. This is showcased in the example scene 29bis_CGDeformMesh_Railway
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply
#3
Is there a way to still keep the original objects scripts similar to Create Gameobject?

Cause if I'm not mistaken, GameObject to Mesh -> Mesh Create does carry over script functions.


Edit*

This is to accomplish two things

1) have spawned object wall pieces bend and conform the the spline, while still having functionality.
2) have a spawned segment collider that extrudes/stretches along the spline which can also have scripts. This is so I can have self intersecting checks.
Reply
#4
(05-10-2023, 12:42 PM)Lupos Wrote: Is there a way to still keep the original objects scripts similar to Create Gameobject?
You would need to make a script, called after the OnRefresh events, that takes the input game objects, and copy whatever data to the output game objects.

PS: I told you earlier that I was busy because of something, now I can talk about it: it is the spring sale on the asset store.
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply
#5
(05-11-2023, 10:27 AM)_Aka_ Wrote: You would need to make a script, called after the OnRefresh events, that takes the input game objects, and copy whatever data to the output game objects.

How would this be done? 

1) The easiest but slowest way would just to copy the original object component data and pass it into the output somehow. Via Get/Add Component.

2) Maybe having two outputs sorta. 1. is the game objects with their scripts, 2. is the curved mesh. I'd loop through the CGMeshResource, grab its mesh/bounds data, and pass that into my new game objects. (Is this what you meant?) 

3) A faster performant way would be to somehow allow pooling of the new objects natively with the renderer.

(05-11-2023, 10:27 AM)_Aka_ Wrote: PS: I told you earlier that I was busy because of something, now I can talk about it: it is the spring sale on the asset store.

Oooh! I see now. Awesome! I actually was able to solve my closed problem, as well as modify the script to position things better. My issue now is not having curved objects with their original script data anymore.
Reply
#6
I was thinking about solution 1. The need to search for a more complex/optimized solution should only raise if the profiler shows so.
If this solution is proven to be problematically slow, then maybe a solution based on separating the input meshes gameobjects from the other scripts, and make the generator work only on the meshes game objects, and then assign the deformed mesh to the gamobject with the other scripts. Not positively sure it is a good solution, just a thought.
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Using Prefabs with transformations reset to original state when using Deform mesh danne_lindwall 3 6 04-28-2023, 01:35 PM
Last Post: _Aka_
  Way to make gameobject follow splines 'human-ly'? yun844 3 11 01-17-2023, 10:18 AM
Last Post: _Aka_
Question Squash To Fit Option for Deform Mesh? richard_firehose 1 12 11-05-2022, 02:25 PM
Last Post: _Aka_
  Scale Deform Mesh Along Spline? / aligning colliders MamasToast 9 71 10-31-2022, 03:44 AM
Last Post: tairoark

Forum Jump: