Announcement

Collapse
No announcement yet.

Wave Visual Editor: Change size of collider

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Wave Visual Editor: Change size of collider

    Hi again,

    it seems that you can't change the size of a collider component...

    if you add an empty entity with a rigid body component and a rectangle collider to my scene
    and try to change the size of the collider, the correct size is displayed.

    But if you start the the game or the simulation it will be reset to zero.
    If you start the game, you get an exception, too.

    Btw. why can't you add more than one collider 2d of the same type?
    How can you build more complex physics objects?

    Regards!

  • #2
    Hi lqscope,

    I'm unable to reproduce the problem you described with the size of a rectagle collider.
    Could you please provide me a Wave project which reproduce it with as little code as possible?
    It will be great for as to detect the issue you described and fix it for our next release.

    Btw. why can't you add more than one collider 2d of the same type?
    A WaveEngine Entity must only have a single Component of the same type. This is enforced by design.

    How can you build more complex physics objects?
    Just by adding child entities to your main physics object entity. By composition, like lego pieces

    Have a nice day.

    Comment


    • #3
      Thank you for your answer.

      I'm not really able to create a test project.
      If I change the size of the collider, the editor crashes.

      If have attached the "broken" project, where the collider size is already reset to zero.

      Maybe this will help.

      For file size reasons, I don't include the package folder. I've used the new version 2.0.2.10

      I've also added the log of the editor itself.

      Regards!
      Attached Files

      Comment


      • #4
        Open the project with Visual Studio or Xamarin Studio, and do the change by code, by modifying the size of the Rectangle of Transform2D component on your entity:

        Code:
        Entity myEmptyEntity = EntityManager.Find("empty");
        
        Transform2D transform = myEmptyEntity.FindComponent<Transform2D>();
        
        transform.Rectangle.Height = 20;
        transform.Rectangle.Width = 100;
        As JuanCano said, you can compose complex entities by composition, adding entities into other entities

        Hope this helps!

        Comment


        • #5
          Thank you,

          I could do this but I need the designer support to build my scene

          So, is this is a bug and will be fixed or is it just like that?

          Regards!

          Comment


          • #6
            Hello lqscope,

            Yes, changing the collider size is a feature that is in our roadmap.

            Meanwhile if you want to support this into the editor you can create a component with 2 properties (Width and Height) and inside it changes the Transform2D rectangle. I give you the code of that component. After that you can add that component from the editor and set its values.

            Code:
            using System;
            using System.Collections.Generic;
            using System.Runtime.Serialization;
            using System.Text;
            using WaveEngine.Framework;
            using WaveEngine.Framework.Graphics;
            
            namespace TestRecent
            {
                [DataContract]
                public class ResizeTransformComponent : Component
                {
                    [RequiredComponent]
                    public Transform2D Transform;
            
                    [DataMember]
                    public float Width
                    {
                        get
                        {
                            return (this.Transform != null) ? this.Transform.Rectangle.Width : 0;
                        }
            
                        set
                        {
                            if (this.Transform != null)
                            {
                                this.Transform.Rectangle.Width = value;
                            }
                        }
                    }
            
                    [DataMember]
                    public float Height
                    {
                        get
                        {
                            return (this.Transform != null) ? this.Transform.Rectangle.Height : 0;
                        }
            
                        set
                        {
                            if(this.Transform != null)
                            {
                                this.Transform.Rectangle.Height = value;
                            }
                        }
                    }
                }
            }
            I hope that helped you
            Regards,
            Antonio

            Comment


            • #7
              Thank you!

              This is a good idea! This kind of approach can help me with several problems

              Regards!

              Comment

              Working...
              X