Announcement

Collapse
No announcement yet.

What is the name of the Blueprint that determines how far the controller moves

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

    [VIVE] What is the name of the Blueprint that determines how far the controller moves

    So I can't get my head around this one. Say you wanted to tell another Blueprint how far the controller has moved how would you do that? Example you have your character change to a flying movement and you want to tell that blueprint how far the controller has moved in real space.

    #2
    Get the controller position each tick, subtract last from current = distance moved?
    Last edited by mordentral; 12-10-2016, 04:49 PM.


    Consider supporting me on patreon

    My Open source tools and plugins
    Advanced Sessions Plugin
    VR Expansion Plugin

    Comment


      #3
      Originally posted by mordentral View Post
      Get the controller position each tick, subtract last from current = distance moved?
      The only problem is that there is no Blueprint called "Controller Position" so I'm guessing I'm pulling a reference to the controller itself and hooking a Blueprint up to that but what Blueprint. That's where I'm stuck.

      Click image for larger version

Name:	controller position.JPG
Views:	1
Size:	53.9 KB
ID:	1119972
      Click image for larger version

Name:	Pulledposition.JPG
Views:	1
Size:	144.9 KB
ID:	1119973

      Comment


        #4
        GetComponentWorldLocation / GetWorldLocation

        Motion controllers are just components where their Relative position to their parents are driven by the tracking system. You can get the component locations to get the world space controller location.
        Last edited by mordentral; 12-12-2016, 12:03 PM.


        Consider supporting me on patreon

        My Open source tools and plugins
        Advanced Sessions Plugin
        VR Expansion Plugin

        Comment


          #5
          Originally posted by mordentral View Post
          GetComponentWorldLocation / GetWorldLocation

          Motion controllers are just components where their Relative position to their parents are driven by the tracking system. You can get the component locations to get the world space controller location.
          I think you might have guessed that this was going to be my next problem.
          Click image for larger version

Name:	getworldlocation.JPG
Views:	2
Size:	38.2 KB
ID:	1119978

          I don't know what I need to plug the GetWorldLocation node into. I'm hoping you might show me a screenshot if what you mean showing the blueprints.

          Comment


            #6
            Its usually about this time that sometimes someone suggests that I learn more about Blueprints but sadly what some people who know Blueprints inside and out don't get is there are some people like me who's brain is wired in a different way and just can't get Blueprints or programing. I've watched hundreds of hours of youtube videos over the last couple of years and unless I see someone put a blueprint together I won't get it and if after learning how to do a simple thing like say setting a boolean if a few months pass without me doing it again I'll forget how to do it and have to look it up again. Is it frustrating? yes, it makes everything ten times harder and its almost as frustrating as coming across some people that because they understand how blueprints work they think my brain must be wired the same way theirs is, that I'm just being lazy and I should just learn more about blueprints but that won't work for the way my brain is wired. Another way to try and explain how my brain is wired and people like me. I have to memorize how every single word is spelt. I know there are rules to spelling and if you learn those rules you can spell nearly any word but I can't and if I don't spell a word on a daily basis then within a few months I will forget how to spell it and will have to memorize it again. I'm sure there are plenty of people like me on this forum that have a passion for making games but they are just too embarrassed to come out and admit that they have the same problem. Anyway I just wanted to get that off my chest

            Comment


              #7
              No need to explain, not everyone has logical operations click easily, that being said you might want to consider getting a friend or someone interested in your project involved to help create the game logic with you. VR games actually aren't going to be totally plug and play in this engine (or any engine currently). You'll run into a lot of areas with no tutorials for what you want to achieve when it comes to VR interactions.


              Consider supporting me on patreon

              My Open source tools and plugins
              Advanced Sessions Plugin
              VR Expansion Plugin

              Comment


                #8
                Originally posted by mordentral View Post
                No need to explain, not everyone has logical operations click easily, that being said you might want to consider getting a friend or someone interested in your project involved to help create the game logic with you. VR games actually aren't going to be totally plug and play in this engine (or any engine currently). You'll run into a lot of areas with no tutorials for what you want to achieve when it comes to VR interactions.
                Youtube is great when it comes to tutorials but a lot of that doesn't translate to VR unfortunately which is why I keep an eye on this sub. People like you and a few others are the only ones putting the time into releasing content for the VR community. Unfortunately I'm the only person I know that works with UE4 so paring with someone else is not an option and I would only feel comfortable working with someone I know well.

                Comment


                  #9
                  I do still need to somehow get this climbing system up and running so if anyone reading this has a system in place and doesn't mind sharing it, it would be a big help. Even if you were following this thread and know what I need to do above to track the controllers I would love if you would post a screenshot. If you have what I need but for some reason never took a screenshot before the snipping tool comes free with windows and is great for screengrabs. If you prefer not to post screenshots even just telling me which BP's I need to plug into the get world location would help also. Thanks.

                  Comment


                    #10
                    Just a few thoughts:

                    1) I've been programming for 17 years. For the first 5 years, I was a stupid idiot who struggled with the basics. I stuck with it and kept trying. Eventually, I got really, really good at it. Now, I can program almost as fast as I can type. My brain has been rewired, and now I think of programming like connecting lego blocks together, and the only thing that slows me down is having to type code fast.

                    2) If you're trying to figure out the distance the motion controller has moved, you're going to be measuring the "change in position over time". Let's forget about motion controllers and UE4 for a moment and take a step back and get a conceptual understanding of what needs to be done. Let's pretend that we're a driver in a car and we are going to drive around the block, but we want to figure out how far we drove. Let's say that our block is 500 feet wide, and 500 feet long. So, we start at position [0,0]. We turn on the car. How far have we gone at time 0? 0 feet. Okay, so now we turn the wheel and drive to the end of the block. How long it took doesn't really matter. We're at position [500,0]. How far did we move? We take our current position [500,0] and measure the distance from our last position [0,0], and we get a total of 500 feet! Okay, so now we take a right hand turn and drive down the block until we're at [500,-500]. How far did we move from our prior position of [500,0]? We moved down 500 units, but the distance we traveled is another 500 units! What's our total distance traveled at this point? On the first leg, we traveled 500 units, on the second leg we travelled 500 units, so the total distance is 500+500. We keep driving around the block now and we return to where we started. What is our total distance traveled? 500+500+500+500, which is 2,000 units! Let's say that we want to measure our total units travelled at a much closer interval! Let's say that every second, we want to know our total distance, and we're traveling at two units per second. So, at time 0, we have traveled 0 feet, and at time 1, we have travelled 2 feet, and time 2, we have travelled 4 feet, etc. We can even pretend that our travel speed is not a constant speed, so maybe we're braking and accellerating. What this means is that in order to figure out our distance travelled, we need to have a running total, and then every second, we just add the difference in distance between the current position and the last position which was 1 second ago. With me so far?

                    Ok, so let's go back to motion controllers. The concept is exactly like the car driving around the block. We are just going to measure the distance between the current position of the motion controller and its last position. As soon as we're done measuring, we update the last position to become the current position. We take this small distance and add it to our running total, and we're done! The code is super simple and straight forward. Here's some pseudo code which you can adapt to either C++ or blueprints

                    Code:
                    //Defined in your class header file or blueprint
                    FVector LastPosition;
                    float TotalDistance;
                    
                    void MyActor::Initialize()
                    {
                       LastPosition = GetMotionController()->GetComponentLocation();
                       TotalDistance = 0;
                    }
                    
                    void MyActor::Tick(float DeltaSeconds)
                    {
                         FVector CurrentPosition = GetMotionController()->GetComponentLocation();
                         TotalDistance += FVector::Distance(CurrentPosition, LastPosition);
                         LastPosition = CurrentPosition;
                    }

                    Comment

                    Working...
                    X