BG1, PRELOAD BG2, PRELOAD

Page 1 of 2 1 2 LastLast
Results 1 to 20 of 37
  1. #1

    Default How to limit an object's movement to a bounding box, smoothly



    Hiya. I am Kris and today I am going to let you in on a simple technique to keep a moving, controlled object from going outside an invisible bounding box.

    There are techniques out there that give mixed results. You may have tried a few yourself, varying from using followers that make the object flee from the sides to removing user control and bouncing the object back into the arena. No such thing here, though. I set out to make this one work as smoothly as possible; as if you are pushing up against an invisible wall and without losing control of your object.



    Start off with something like this: a block of holographic material with a controlinator on it; as you can see here, the left/right and top/down output of the left joystick are hooked to an advanced mover (don't forget to set its deceleration to 100%. Thanks Deafmanwalking). If you'd hop into the controlinator right now, you can freely move block around. We want to go and limit that to an invisible bounding box.

    Whatever movement you make with the joystick, it can always be split up into a horizontal vector and a vertical vector. For example, you move the block into a north-west diagonal direction; this means there is a negative movement on the X-axis combined with a positive movement on the Y-axis. We are going to use this principle.



    Here I have split up both the horizontal signal and the vertical signal from the joystick, using signal splitters. I hooked each separated signal to its corresponding input of signal combiners to put them back into a composite signal again and feed those into the advanced mover. Why? Good that you ask. We'll be using those splitted signals soon.



    Let's focus on the bounding box now. We'll be needing not just one rectangular shape, but four separate pieces in order to distinguish between the upper, lower, left and right boundary. Make them from holographic material set to 0% brightness so that they will be invisible in play or preview mode. Tag each side of our boundary with a unique tag. For instance "North", "East", "South" and "West". Glue everything together so you can easily move the box later if you need to.



    Now here is where we put it all together! In between the signal splitters and signal combiners, put an AND gate for each separate signal. So, four total. Hook their output to the signal combiners like in the picture. Also, connect the signals from the splitters to the inputs of the AND gates, just like displayed above.

    What we need now is to accompany each of the splitted signals with an impact sensor. One for tag "North" paired with the positive (+) part of the vertical signal. One for tag "South" for the negative part (-) of the vertical signal. "East" goes with the (+) of the horizontal signal and "West" with the (-) of the horizontal signal. Set all the impact sensors to accept touching, but not rigid connections. Also set them to output a reverse signal; this means that they will give off a signal when the moving object is NOT touching the boundary.

    Connect each impact sensor's output to an input of the AND gate.

    Putting it to the test

    What will happen when you jump into the controlinator is that you can now move freely around until you hit a boundary. For instance, you hit "North": the impact sensor for "North" will register and stop giving off a signal, meaning the AND gate with the (+) for vertical movement will be interrupted and there will no longer be any "up" movement put through into the vertical signal combiner. The block will stop moving up. However, all the other signals will be uninterrupted. This means, you can move the block down, sideways, or whatever you like.

    No bouncing, no friction, no loss of control. Smoothly!


  2. #2
    Junior Sackperson Jayhawk_er's Avatar
    Points: 11,183, Level: 31
    Level completed: 91%, Points required for next Level: 67
    Overall activity: 1.0%
    7 days registered 100 Experience Points 250 Experience Points 30 days registered 500 Experience Points
    PSN
    Jayhawk_er
    Join Date
    Jul 2010
    Location
    USA UT
    Posts
    407
    Blog Entries
    1

    Default

    Wow, the funny thing is I've seen this so many times but I could never really figure out how it worked haha It could just be my ignorance to all things logic, but anyways... thanks!

    My LPB2 Levels
    Timber Hopping
    Pirate Perils .::Spotlighted::.
    Jet Strike .::Spotlighted::.

    Team of Prattz, Joey, OneEyedBanshee, and Jayhawk_er
    MTG - A Malevolent Tale .::Mm Picked!::.


    Hard work never killed anybody, but why risk it?

  3. #3

    Default

    the issue with this setup is the fact you lose analog control over the mover, for example you cant hold the stick half way to move half speed, to fix this you need to remove the AND gates from the setup.
    in your second picture, put a node in the middle of each of the 4 wires, so each wire goes through it's own node, then move each node into it's own microchip, then connect the inverted impact sensors to the corresponding microchips. this will still behave the same with the bounding box, but you will have full analog control


  4. #4

    Default

    good point evret, ive used that technique b4 as well

    You dont need any of this logic if you use holograms with collision.

    heres the thread i posted for it
    http://www.lbpcentral.com/forums/sho...784#post840784

    You can add a material tweaker to the holograms, set physics sounds to none, 0 friction and a rocket rotator to keep it straight. Making the hologram your on a circle will help.

    not sure if this would be smoother but wil def save u some logic space. Of course your technique will be more usefull in certain circumstances so thx for the tip.
    Last edited by ShadowTyphoon; 05-07-2011 at 01:21 AM.
    Sky City Coming Soon: I've realeased barely any info on it and the locked backup on my planet has 40+ hearts so far, thx for all support to everyone who has showed interest and to all my friends!

  5. Thanks!


  6. #5

    Default

    the problem with that is you cant use the layer you use for the cursor and bounding box to build your level, using this logic method is still rather simple but allows you to use all layers as normal for your level.
    there is also a glitch that makes neon material invisable, it has slightly different uses to the glitched holo because sackboy collides with it too, not just materials. not sure how to recreate it coz PPp_Killer just gave it to me in create mode and i just corner edit it to the shape i want when i need it

  7. #6

    Default

    You could create the collisionss to occur in the foreground, and have them stem with normal hologram into the normal dimensions, but i could see how that could end up being a hassle.
    Sky City Coming Soon: I've realeased barely any info on it and the locked backup on my planet has 40+ hearts so far, thx for all support to everyone who has showed interest and to all my friends!

  8. #7
    Sackperson Private Antikris's Avatar
    Points: 18,962, Level: 42
    Level completed: 2%, Points required for next Level: 888
    Overall activity: 0%
    100 Experience Points 7 days registered 250 Experience Points 30 days registered 500 Experience Points
    PSN
    Stellakris
    Join Date
    Nov 2010
    Location
    Amsterdam, Holland
    Posts
    1,371

    Default

    Quote Originally Posted by evret View Post
    the issue with this setup is the fact you lose analog control over the mover, for example you cant hold the stick half way to move half speed, to fix this you need to remove the AND gates from the setup.
    That was my concern with this setup as well, but I am using this exact setup in a level of mine and the problem you describe does not occur; I can move at variable speeds and the impact sensor is not overriding that with its 100% signal strength. This may be something I don't understand; perhaps when it comes to AND gates the lowest of values gets passed through. I know that OR gates behave similarly in that they pass through the strongest of incoming signals...

    Quote Originally Posted by ShadowTyphoon View Post
    You dont need any of this logic if you use holograms with collision. heres the thread i posted for it
    http://www.lbpcentral.com/forums/sho...784#post840784
    You can add a material tweaker to the holograms, set physics sounds to none, 0 friction and a rocket rotator to keep it straight. Making the hologram your on a circle will help.
    not sure if this would be smoother but wil def save u some logic space. Of course your technique will be more usefull in certain circumstances so thx for the tip.
    Going physical to save a few bits of logic would be the opposite of a good idea to me. Sooner or later it will dictate what you can and cannot do in your level, so I like to keep my options open. For instance, if the holo barrier in my example would be physical, I would not be able to make enemies, bullets and other objects to move through it, unless I reserve one plain in the entire level for that bounding box (which in turn only limits one object).

    An example is the camel shooter level in Story Mode, where you control a cursor from the back of a vehicle; the cursor's movement is bound to an invisible box that moves along with the vehicle.

  9. Thanks!


  10. #8

    Default

    i just did a few tests and yeah your right, AND gates will output the value of the lowest input, aslong as all inputs have some form of active input. i assumed they outputed the highest value like OR gates but had never tested it till now. definitely good to know

  11. #9

    Default

    Am i right in thinking that this technique could be used to keep my Landspeeder off the ground ?? ........Using just the N & S Holos placed @ top & bottom of the Landspeeder (set to follow a tag on the speeder)
    Last edited by Broonba; 05-07-2011 at 06:34 PM.

  12. #10
    Sackperson Private Antikris's Avatar
    Points: 18,962, Level: 42
    Level completed: 2%, Points required for next Level: 888
    Overall activity: 0%
    100 Experience Points 7 days registered 250 Experience Points 30 days registered 500 Experience Points
    PSN
    Stellakris
    Join Date
    Nov 2010
    Location
    Amsterdam, Holland
    Posts
    1,371

    Default

    Quote Originally Posted by Broonba View Post
    Am i right in thinking that this technique could be used to keep my Landspeeder off the ground ?? ........Using just the N & S Holos placed @ top & bottom of the Landspeeder (set to follow a tag on the speeder)
    I think you can, yes.

  13. #11

  14. #12

    Default

    Quote Originally Posted by Antikris View Post
    I think you can, yes.
    Thanks for the reply man........I tried it out (using the N & S method & it works perfectly
    I put them so that they were both touching the speeder........It now has full L/R movement & no U/D, so it now "appears" to levitate above the ground.
    Thanks again for the idea.

  15. #13

    Default One thing for beginners

    Just one thing worth knowing to beginners like me:
    For this to work you need to set Deceleration to 100% or similar in the Advanced Mover. Otherwise keeps moving through the holo.

  16. Thanks!


  17. #14

    Default

    I also did a tutorial about this.

    Check it out if you want to see how to create it


    Check out my LBP2 YouTube channel: SilverScorp91
    The biggest LBP2 tutorial channel with lots of tutorials and community levels


  18. Thanks!


  19. #15

    Default

    If anyone finds an effective way to produce this for a moving screen, please tell. My creations with this all rely on the cursor to bounce back off the walls, otherwise you could simply just leave the cursor behind as you move away.

    Using a physical means like a string to restrict movement works for this, but an completely logic based method would be nice.
    Playing LBP Vita. Making a 'FF Tactics - esque' game.

  20. #16
    Sackperson Private Antikris's Avatar
    Points: 18,962, Level: 42
    Level completed: 2%, Points required for next Level: 888
    Overall activity: 0%
    100 Experience Points 7 days registered 250 Experience Points 30 days registered 500 Experience Points
    PSN
    Stellakris
    Join Date
    Nov 2010
    Location
    Amsterdam, Holland
    Posts
    1,371

    Default

    Quote Originally Posted by SSTAGG1 View Post
    If anyone finds an effective way to produce this for a moving screen, please tell. My creations with this all rely on the cursor to bounce back off the walls, otherwise you could simply just leave the cursor behind as you move away.
    I made bouncing behavior before as well and it left me really unsatisfied, hence the focus on "smooth" in the title of my post.

    The blocks that making the bounding box in my tutorial can be glued together and moved. You can either move them by logic or glue them to another base object that moves - like the camel in the Story Mode shooter level.


    Quote Originally Posted by ScorpSkull View Post
    I also did a tutorial about this.
    Great video! Keep on sharing.

  21. #17

    Default

    Quote Originally Posted by Antikris View Post
    I made bouncing behavior before as well and it left me really unsatisfied, hence the focus on "smooth" in the title of my post.

    The blocks that making the bounding box in my tutorial can be glued together and moved. You can either move them by logic or glue them to another base object that moves - like the camel in the Story Mode shooter level.
    I meant just for a moving box I had the bouncing. I've produced several of the border versions myself (my level menu test even has it).

    My question is how exactly would you get the cursor to move in step with the moving frame. It can be done for views that move at constant speed, but ineffective for variable AFAIK.
    Playing LBP Vita. Making a 'FF Tactics - esque' game.

  22. #18

    Default

    Quote Originally Posted by SSTAGG1 View Post
    My question is how exactly would you get the cursor to move in step with the moving frame. It can be done for views that move at constant speed, but ineffective for variable AFAIK.
    The frame could transmit the current speed through a tag (one for up-down speed, one for left-right), the cursor can pick it up and split the positive (right) or negative (left) component of the speed tag sensor signal. In stead of turning off the movement when colliding, you set the speed to the speed of the frame with a microchip as a relay.

    For example, when the frame moves right, the frame sends speed 3 through the Left-Right tag. If you hit the left border, you want to use the positive component of that tag (3) to move right, and if you hit the right border you want the negative component of the tag (-0).

    Actually, that's not quite right either. If you hit the left border, you want to use the Left-Right tag speed if the player's speed is less, and if you hit the right border you want to use the Left-Right if the player's speed is greater. Yeah, that sounds about right. Helps thinking backwards.

    So uhm, you can take it from here?

  23. #19

    Default

    Hmmmm I followed all the instructions but its still going through it.... obviously I have done something wrong :/

  24. #20
    LBPCentral Spotlight Crew Home Energy Reactor Mr_Fusion's Avatar
    Points: 25,948, Level: 49
    Level completed: 40%, Points required for next Level: 602
    Overall activity: 17.0%
    7 days registered 100 Experience Points Created Blog entry 250 Experience Points 30 days registered
    PSN
    Mr_Fusion
    Join Date
    Apr 2011
    Location
    Australia
    Posts
    2,373
    Blog Entries
    9

    Default

    Quote Originally Posted by SSTAGG1 View Post
    If anyone finds an effective way to produce this for a moving screen, please tell. My creations with this all rely on the cursor to bounce back off the walls, otherwise you could simply just leave the cursor behind as you move away.

    Using a physical means like a string to restrict movement works for this, but an completely logic based method would be nice.
    I was checking out something that Evret was messing with in his create mode, the rig was... Impressive to say the least.

    He actually had to explain what it did... couldn't really understand HOW it did it.

    The cursor can be moved with R Stick and stays in the 'same' spot relative to sackboy, and is limited to how far away it can go.

    Still digesting how it works, but it's not up to me to share it, he didn't say top secret, but I don't think its 100% ready.

    But, It did inspire me to have a crack at it... well sort of.

    In the (scrapped) 2 player version of my stage Miserable Flying Weather, I actually use something to this .

    Player 2 can zoom around a screen on a hover board but needed to grab a rope on the DeLorean controlled by player 1. When grabbing a rope attached to Player 1, they lost all control until they let go. Their position stayed the same distance from P1 and if P1 moved they moved with them.

    I'll see if I can re-purpose it to be a cursor. In it's current build I'm pretty sure it'll work, but the only thing it won't do is respond to pressing jump. It also relies on using a sackbot.

    If I get it working; I'll give it a stupid name and share it.

    Quote Originally Posted by l199320 View Post
    Hmmmm I followed all the instructions but its still going through it.... obviously I have done something wrong :/
    Jump onto scorpskull's video next and grab my example to play with.
    Last edited by Mr_Fusion; 07-12-2011 at 07:48 AM.

Page 1 of 2 1 2 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •