Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Join us on Dec 8, 2022, between 7 am & 7 pm EST, in the DOTS Dev Blitz Day 2022 - Q&A forum, Discord, and Unity3D Subreddit to learn more about DOTS directly from the Unity Developers.
    Dismiss Notice
  3. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice

How can i get runtime vertices in 2d animated sprite?

Discussion in '2D Experimental Preview' started by Yeung, Jul 15, 2019.

  1. Yeung

    Yeung

    Joined:
    May 31, 2013
    Posts:
    2
    Hey guys,
    I have a sprite that was animated by adding bones and geometry with 2D animation version 2.0.0. The sprite is animating great and now i want to add collider to my sprite. But i find that the sprite.vertices are not updated during runtime, which are the initial vertices of the sprite.

    How can i get the vertices positions during runtime?

    Thank you for your help!
     
  2. ChuanXin

    ChuanXin

    Unity Technologies

    Joined:
    Apr 7, 2015
    Posts:
    994
    It is not possible with the version of 2D Animation you are using unfortunately.

    We will expose this in a future version.
     
  3. Kidara

    Kidara

    Joined:
    Jul 6, 2017
    Posts:
    16
    Up, is it now possible?
     
  4. MrPaparoz

    MrPaparoz

    Joined:
    Apr 14, 2018
    Posts:
    156
  5. Leo-Yaik

    Leo-Yaik

    Unity Technologies

    Joined:
    Aug 13, 2014
    Posts:
    401
  6. stickylab

    stickylab

    Joined:
    Mar 16, 2016
    Posts:
    81
  7. Ted_Wikman

    Ted_Wikman

    Unity Technologies

    Joined:
    Oct 7, 2019
    Posts:
    792
    We do not have any examples of this. Could you share with us where you are currently stuck @afakul?
     
  8. dikar771

    dikar771

    Joined:
    Oct 30, 2015
    Posts:
    17
    Hey,

    Just tried to get vertices with GetDeformedVertexPositionData() in Update method and assign positions to test spheres: spheres moves in another direction than sprite with real vertices. How can I get global vertices positions?
     
  9. dikar771

    dikar771

    Joined:
    Oct 30, 2015
    Posts:
    17
    Solved. It seems that GetDeformedVertexPositionData() returns localPositions relative to SpriteSkin's transform. Perhaps this should be reflected in the documentation