Coder Social home page Coder Social logo

Comments (8)

lilligreen avatar lilligreen commented on July 19, 2024

Sorry, didn't realize you can't attach code to an issue. Created a pull request - issue 44 to replace this one.

from torque2d.

lilligreen avatar lilligreen commented on July 19, 2024

On second thought, pull request 44 only has toy updates and not a fix to this, so I will keep them as two separate items. Sorry for the confusion.

from torque2d.

doodaddy64 avatar doodaddy64 commented on July 19, 2024

Are you saying there is an issue with radius that requires an engine fix but that your pull-request is not that fix?

from torque2d.

lilligreen avatar lilligreen commented on July 19, 2024

Yes, pull request 44 is only an update to ShapeVectorToy with improvements. While testing my version of ShapeVectorToy I noticed that setCircleRadius is not actually setting the radius, but the diameter of a ShapeVector circle. Unfortunately I do not know C++ to fix this myself, so I can only report it.

from torque2d.

crabmusket avatar crabmusket commented on July 19, 2024

Are you sure the radius is setting the diameter? I'm looking at this code in ShapeVector::renderCircleShape:

    for (int32 i = 0; i < k_segments; ++i)
    {
        Vector2 v = position + radius * Vector2(cosf(theta), sinf(theta));
        glVertex2f(v.x, v.y);
        theta += k_increment;
    }

This seems to use radius correctly, and it's passed directly from mCircleRadius, which is what you set when you touch CircleRadius in script. You mentioned that a circle of radius 2 fits inside a box of size 2 - are you sure the 2 is not the radius of the box as well?

from torque2d.

crabmusket avatar crabmusket commented on July 19, 2024

However, I did find this in ShapeVector::setPolyPrimitive:

    // Special-Case Quad?
    else if ( polyVertexCount == 4 )
    {
        // Yes, so set Quad.
        mPolygonBasisList[0].Set(-1.0f, -1.0f);
        mPolygonBasisList[1].Set(+1.0f, -1.0f);
        mPolygonBasisList[2].Set(+1.0f, +1.0f);
        mPolygonBasisList[3].Set(-1.0f, +1.0f);
    }

Compare that to the old script from the toy:

        case "Square":
            %points = "-0.5 -0.5 0.5 -0.5 0.5 0.5 -0.5 0.5";

Seems that the new code and old code are behaving slightly differently. Using setPolyPrimitive, you get a square of radius 20, but in the old code it was diameter 20.

from torque2d.

lilligreen avatar lilligreen commented on July 19, 2024

Ok, I did some more testing in Torquescript. Looks like the issue is with setSize for ShapeVectors.

shapevector

To the left is a ShapeVector with a size of 20 and to the right a scene object with a size of 40 (AABB turned on for both). Is this a bug or is there a reason that the size property is different for ShapeVectors compared to SceneObjects?

from torque2d.

MichPerry-GG avatar MichPerry-GG commented on July 19, 2024

I went ahead and resolved the issue in revision ce0e10f.

from torque2d.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.