map-pin Tutorial: Creating a Moving Object

  • Three
  • Three's Avatar Topic Author
  • Offline
  • Lead Developer
  • Lead Developer
  • level designer
More
04 Oct 2015 20:51 - 04 Oct 2015 20:56 #1 by Three
Tutorial: Creating a Moving Object was created by Three
Hello, level builders!
1.60 introduced PlatinumQuest's path node system, which allows for moving, rotating, and scaling entities as you play. In this post, I will show you how to use this system in your own levels.
--Part 1: Moving Objects--

So, let's say you'd like this gem to move around in a circle. This red ring will demonstrate where we want the gem to travel.
First, push F4 to open the World Editor Creator. Open this file tree and add four PathNodes to your level. For the sake of this tutorial, the nodes will be named "path1", "path2", etc. Note that the path nodes are slightly sunken into the ground -- this is because objects will travel slightly above the center of the grey blob, not through the center of the node as a whole. Be careful!
Now comes the tricky part. Push F3 with "path1" selected to bring up the World Editor Inspector. You'll notice a lot of dynamic fields. Here's what you should enter for all of these variables in this case. Any field not listed can be ignored.
TimeToNext: Any number you want, but I will be setting it to 1000ms for the case of this tutorial.
UsePosition: 1
UseRotation: 0
UseScale: 0
NextNode: Name of the next path node in the loop. So, for path1, enter "path2". For path2, enter "path3" etc. The last node (path4 in this case) should have this set to the first node (path1).
If all your nodes look something like this, you're good to go. Now, we actually want the gem to move on this path. Simply add a dynamic field to your gem with the name "path". The value should be one of the path nodes, preferably the first one in the chain. Restart your level... and viola! It's a bit difficult to show off in a picture, but the gem should now be moving on the path!
--Part 2: Rotating Objects--

Rotating entities are arguably simpler to create than moving entities. Let's say that you want a trapdoor to constantly rotate on the Z axis for some reason.
First, place the trapdoor and three path nodes in your level. Name the path nodes "rotate1", "rotate2", and "rotate3". The nodes can be placed anywhere you like, they don't need to be in the same location as the trapdoor. Rotate "rotate2" 180 degrees on the Z axis. It should look something like this. Here's what you should enter for all of these variables in this case. Any field not listed can be ignored.
TimeToNext: Any number you want, but I will be setting it to 1000ms for the case of this tutorial. However, the last node's TImeToNext should be 1ms to keep the movement smoother.
UsePosition: 0
UseRotation: 1
UseScale: 0
NextNode: Name of the next path node in the loop. So, for rotate1, enter "rotate2". For rotate2, enter "rotate3" etc. The last node (rotate3 in this case) should have this set to the first node (rotate1).
Just like the gem, add the dynamic field "path" to the trapdoor with the value being the first node in the chain. Your trapdoor is now rotating like crazy. Unfortunately, rotating entities' collision is generally very buggy. Use at your own risk!
--Part 3: Scaling Objects--

Finally, you can use nodes to scale objects on the fly. We're going to make a Jump Boost grow and shrink back to normal size over and over again, so place a Jump Boost and three path nodes. Name the nodes "scale1", "scale2", and "scale3". Set the scale of scale2 to 2, 2, 2. It should look like this. Hopefully you know what to do here by now, but just in case, here's what you set the values of each node.
TimeToNext: Any number you want, but I will be setting it to 1000ms for the case of this tutorial. However, the last node's TImeToNext should be 1ms to keep the movement smoother.
UsePosition: 0
UseRotation: 0
UseScale: 1
NextNode: Name of the next path node in the loop. So, for scale1, enter "scale2". For scale2, enter "scale3" etc. The last node (scale3 in this case) should have this set to the first node (scale1).
Add the "path" field to the Jump Boost with the value of the first node in the chain... ...and boom! It's growing and shrinking. Be aware that scaling objects like this is very buggy, too, as sometimes, only the collision scales, and not the DTS model.


I hope you have found this guide useful.
In case you'd like to check it out for yourself, here's a download link for the .mis file used in this tutorial: bit.ly/1M4pt4t
If you have questions or are confused, just ask me and I'll try my best to help you out.

Follow me on twitter at @threefolder
Last edit: 04 Oct 2015 20:56 by Three. Reason: derp
The following user(s) said Thank You: HiGuy, Jeff, Kalle29, Kurt, Frostfire, Nature Freak, Technostar, Robert, Weather, Xedron

Please Log in or Create an account to join the conversation.

  • HiGuy
  • HiGuy's Avatar
  • Offline
  • Administrator
  • Administrator
  • At college, may not be around
More
04 Oct 2015 21:00 - 07 Dec 2015 12:48 #2 by HiGuy
Replied by HiGuy on topic Tutorial: Creating a Moving Object

Threefolder wrote:
...and boom! It's growing and shrinking. Be aware that scaling objects like this is very buggy, too, as sometimes, only the collision scales, and not the DTS model.


This is due to the nodes not sending scale updates... I'm not entirely sure why they don't Restarting the level twice seems to fix this, but for now I'd recommend just not using scaling objects.

Edit: fixed as of 1.60 patch 5. Disregard me.

PQ in a nutshell
function clientcmd12dothepq() {
    commandToClient(LocalClientConnection, '34onthedancefloor');
}
Last edit: 07 Dec 2015 12:48 by HiGuy.

Please Log in or Create an account to join the conversation.

  • Jeff
  • Jeff's Avatar
  • Offline
  • Developer
  • Developer
  • PlatinumQuest Programmer
More
04 Oct 2015 21:17 #3 by Jeff
Replied by Jeff on topic Tutorial: Creating a Moving Object
Great guide!

/pablo

I am a programmer. Most here know me for being one of the major contributors to Marble Blast Platinum and PlatinumQuest.

Please Log in or Create an account to join the conversation.

  • Technostar
  • Technostar's Avatar
  • Offline
  • Intermediate Marbler
  • Intermediate Marbler
  • I Factorial
More
04 Oct 2015 23:49 - 05 Oct 2015 03:20 #4 by Technostar
Replied by Technostar on topic Tutorial: Creating a Moving Object
Thank you for making this! Now to make a level using this mechanic...
EDIT: How do you make a triggered object? This section does not cover that.

System.out.println("Hello");
Last edit: 05 Oct 2015 03:20 by Technostar.
The following user(s) said Thank You: Frostfire

Please Log in or Create an account to join the conversation.

More
08 Oct 2015 14:40 #5 by Nockess
Replied by Nockess on topic Tutorial: Creating a Moving Object
I tried this with a moving platform. At the moment, I'm not worried about that platform. I'm worried about the movement.
Is there an option to make my platforms' smoothing type accelerate?

First player ever to get all of the Awesome Times.

Please Log in or Create an account to join the conversation.

More
08 Oct 2015 15:57 - 08 Oct 2015 15:58 #6 by Nature Freak
Replied by Nature Freak on topic Tutorial: Creating a Moving Object
[GASP] You can create moving entities? Yay! I can't wait for custom levels with them! They would be really fun to experiment with! And thank you so much for providing this thorough and helpful tutorial, Threefolder!
Yes, there are a lot of exclamation points. Yes, I am pretty excited about moving entities.
Last edit: 08 Oct 2015 15:58 by Nature Freak.

Please Log in or Create an account to join the conversation.

  • IsraeliRD
  • IsraeliRD's Avatar
  • Offline
  • Project Manager
  • Project Manager
  • Dragon Power Supreme
More
08 Oct 2015 16:42 #7 by IsraeliRD
Replied by IsraeliRD on topic Tutorial: Creating a Moving Object

NatureFreak wrote:
[GASP] You can create moving entities?

I'm not sure how you missed the 1.60 announcement stating so.

"matan, now i get what you meant a few years back when you said that "the level in mbg is beyond me" after the last rampage i noticed things were insane, and now i truly feel that too" - Dushine, 2015.
The following user(s) said Thank You: Three

Please Log in or Create an account to join the conversation.

  • Marblemaster1
  • Marblemaster1's Avatar
  • Offline
  • Advanced Marbler
  • Advanced Marbler
  • QuArK proudly!
More
07 Dec 2015 04:07 #8 by Marblemaster1
Replied by Marblemaster1 on topic Tutorial: Creating a Moving Object
I have been out of the loop for far too long. This may be enough to get me back making levels again.

while (!PQ.getIsReleased())
{
      System.out.println("PQ WHERe");
}
You know what's boring? Opaque marble skins. You know what's not? Glass Marbles!

Please Log in or Create an account to join the conversation.

More
17 Mar 2016 17:23 #9 by Pokko
Replied by Pokko on topic Tutorial: Creating a Moving Object
How do I make a platform to rotate around itself or am I just doing something wrong

Please Log in or Create an account to join the conversation.

  • Three
  • Three's Avatar Topic Author
  • Offline
  • Lead Developer
  • Lead Developer
  • level designer
More
24 Mar 2016 00:35 - 24 Mar 2016 00:37 #10 by Three
Replied by Three on topic Tutorial: Creating a Moving Object
What exactly are you trying to do? If you want to rotate a platform, do the same thing as in Part 2, but with an interior instead of a trapdoor. Be warned that the collision is very funky and there's no real marble physics on rotating platforms, however.

Follow me on twitter at @threefolder
Last edit: 24 Mar 2016 00:37 by Three.

Please Log in or Create an account to join the conversation.

More
24 Mar 2016 23:15 #11 by Pokko
Replied by Pokko on topic Tutorial: Creating a Moving Object
My interiors are rotating around one of its corner, not around its center point

Please Log in or Create an account to join the conversation.

  • Three
  • Three's Avatar Topic Author
  • Offline
  • Lead Developer
  • Lead Developer
  • level designer
More
25 Mar 2016 00:58 #12 by Three
Replied by Three on topic Tutorial: Creating a Moving Object
Ah, if you want your interior to move around its center point, you'll have to center it at 0 0 0 in Constructor or Quark. Easiest way to do this in Constructor is to select all your brushes, push T, and use the Center options to align it to 0 0 0.

Follow me on twitter at @threefolder
The following user(s) said Thank You: HiGuy

Please Log in or Create an account to join the conversation.

More
30 Mar 2016 16:35 #13 by Pokko
Replied by Pokko on topic Tutorial: Creating a Moving Object
And why is my interior always far away from the nodes? What am I doing wrong this time?
Attachments:

Please Log in or Create an account to join the conversation.

  • Weather
  • Weather's Avatar
  • Offline
  • Professional Marbler
  • Professional Marbler
More
30 Mar 2016 17:12 #14 by Weather
Replied by Weather on topic Tutorial: Creating a Moving Object
Perhaps the usePosition variable on both nodes isn't 1. Either that or the brushes in the interior aren't centered to the origin of the interior as Threefolder said.

Please Log in or Create an account to join the conversation.

  • HiGuy
  • HiGuy's Avatar
  • Offline
  • Administrator
  • Administrator
  • At college, may not be around
More
31 Mar 2016 13:25 #15 by HiGuy
Replied by HiGuy on topic Tutorial: Creating a Moving Object
Chances are your interior isn't centered at 0 0 0. Go check in constructor that it actually sits at the origin. If it's off to the side it will behave like this.

PQ in a nutshell
function clientcmd12dothepq() {
    commandToClient(LocalClientConnection, '34onthedancefloor');
}

Please Log in or Create an account to join the conversation.

More
01 Apr 2016 17:18 #16 by Pokko
Replied by Pokko on topic Tutorial: Creating a Moving Object
Thanks. It works now. But now my marble is going through the moving platform :huh:

Please Log in or Create an account to join the conversation.

  • Weather
  • Weather's Avatar
  • Offline
  • Professional Marbler
  • Professional Marbler
More
01 Apr 2016 18:35 #17 by Weather
Replied by Weather on topic Tutorial: Creating a Moving Object
Path nodes don't calculate collision properly. The Platinum Team claims it's not possible. If you want a properly colliding MP, you'll need to use the regular system or change the material properties for the texture on your MP.

Please Log in or Create an account to join the conversation.

Moderators: Kalle29AayrlRegislian