Announcement

Collapse
No announcement yet.

How would I math together instances of a static mesh in BP on the outside of a large sphere?

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

    How would I math together instances of a static mesh in BP on the outside of a large sphere?

    Hi everyone.

    A call for all math geniuses :-)

    I want to create instances of a static mesh, each with its own rotation properties on the outside of a large sphere.

    Its supposed to be a parameter in space. Like an asteroid belt but not a belt its all over the surface of a sphere.

    I was thinking of cheating and just create a large sphere and use the foliage brushes and just paint instances onto the outside of the sphere.

    But I was wondering if there is a way to math it out with vectors in stead.

    I found a tutorial on how to set distances in world space of instanced objects in BP but not in a radius or outside of a sphere.

    Anyone have an idea? TY !!

    Click image for larger version

Name:	Raduis.jpg
Views:	301
Size:	88.9 KB
ID:	1633293

    #2
    So I can get this far.
    But don't know how to set the forloop index into a radius ???
    Want those objects to sit around the outside of that sphere collision :-)
    I cant find a radius vector node.

    Click image for larger version  Name:	Radius.jpg Views:	1 Size:	169.7 KB ID:	1633306

    Comment


      #3
      I don't think there is a way to do this. Ha. Looks like it.

      Comment


        #4
        Unless there is a way to generate a radius with vectors somehow.

        Comment


          #5
          Found this in another forum

          2



          In code, this is really simple to do. The following pseudo-code assumes that the objects' origins are in the center, but if they are not, then all you have to do is to translate the final positions to account for the objects' actual origins.

          float offset =0.0f;// Allows you to offset the initial object.constfloat step =360.0f/ objectCount;for(float angle = offset; angle <360.0f+ offset; angle += step){constfloat radians = angle * PI /180.0f;constfloat x = circleCenter.X + cos(radians)* circleRadius;constfloat y = circleCenter.Y + sin(radians)* circleRadius;object->SetPosition(Vector2(x, y))}

          share|improve this answer

          answered Sep 3 '17 at 10:41


          Tyyppi_77 5,15031835






          • How to translate this in blueprint ?Wildfire Sep 3 '17 at 10:44


          • Translating the code above to blueprints should be fairly trivial. I have no experience with blueprints but surely you can create float variables, initialize them with values, loop with a for- or a while-loop and finally set an object's position.Tyyppi_77 Sep 3 '17 at 10:47


          Comment


            #6
            Something like this?

            Click image for larger version

Name:	Rot.jpg
Views:	206
Size:	186.9 KB
ID:	1633319

            Comment


              #7
              confused by what you are doing honestly, but regardless there's many way's to skin a cat.

              create a blueprint for Spore Spirit.

              Add a Scene Component at 0,0,0
              Add in the mesh of the Spore Spirit. Set the location X of spore spirit to the distance you wish it to be away from the center.

              in the construction script for your level (i assume End_Zone_BP is the level)
              For Loop from 0 to 360 - and pick an axis.
              body > add blueprint instance, set instance rotation to index

              Should be done.

              https://gyazo.com/967d43ff553ee2afb1be32d85f151954
              https://gyazo.com/a0e330bb8909018691ddd45f7000845d

              Adding actors tutorial:
              https://docs.unrealengine.com/en-US/...nts/index.html

              Also, make sure not to ever think it a good idea to add an OnTick item to these actors unless you REALLY, REALLY, REALLY need to... (and you don't you can animate by assigning it an animation blueprint). It's 360 ticks happening for no reason...

              Oh, you should not change the location from the script, but you can if you need to offset them. I just see all of your pictures being evenly spaced out, so kinda figured you wanted it static.
              If you wanted to offset them i would use a random number between -30 and 30 to offset the z axis rotation. gives it a nice range of 60 degree which may look like an asteroid belt.
              Last edited by MostHost LA; 06-20-2019, 12:41 AM.

              Comment


                #8
                Originally posted by MostHost LA View Post
                confused by what you are doing honestly, but regardless there's many way's to skin a cat.

                create a blueprint for Spore Spirit.

                Add a Scene Component at 0,0,0
                Add in the mesh of the Spore Spirit. Set the location X of spore spirit to the distance you wish it to be away from the center.

                in the construction script for your level (i assume End_Zone_BP is the level)
                For Loop from 0 to 360 - and pick an axis.
                body > add blueprint instance, set instance rotation to index

                Should be done.

                https://gyazo.com/967d43ff553ee2afb1be32d85f151954
                https://gyazo.com/a0e330bb8909018691ddd45f7000845d

                Adding actors tutorial:
                https://docs.unrealengine.com/en-US/...nts/index.html

                Also, make sure not to ever think it a good idea to add an OnTick item to these actors unless you REALLY, REALLY, REALLY need to... (and you don't you can animate by assigning it an animation blueprint). It's 360 ticks happening for no reason...

                Oh, you should not change the location from the script, but you can if you need to offset them. I just see all of your pictures being evenly spaced out, so kinda figured you wanted it static.
                If you wanted to offset them i would use a random number between -30 and 30 to offset the z axis rotation. gives it a nice range of 60 degree which may look like an asteroid belt.
                Great thank you very much.
                I will look at this tomorrow first thing !!

                Comment


                  #9
                  I don't have one single TIC in the entire game project.
                  You can be proud of me :-)

                  Comment

                  Working...
                  X