Q3D V-2.4 [3D Physics + Skeletal Animation UPDATE]

Post your completed addons to share with the community

Post » Sat Jun 03, 2017 12:18 pm

QuaziGNRLnose wrote:@cjbruce

I suggest doing away with the physics based wheels entirely, and making the cars spheres/blocks instead. This should significantly boost performance and is how most video-game cars are implemented. Im assuming you made the wheels invisible because they were acting strangely? I realize this is probably a big change to make but my experience tells me its the best way to go.


The physics-based wheels are acting great, and aren't the CPU hogs that I am referring to. The reason I want to keep them and not show them is they provide for a nice movement feel and automatically take care of orienting the players properly when going over rough terrain or when driving up on top of other players. I tried a raycasting solution earlier, but it was a little wonky and never looked quite right. In the end, you might be right--it will make for a much simpler game to remove the wheel-based movement, but I would like to try to keep them for now.

The CPU hog I am referring to has to do with positioning/rotation of the visual elements. I should be able to parent them to the body and do rotation about a local axis, shouldn't I?


Edit: Here is a screenshot showing the offending events:
Image
www.simbucket.com - HTML5 Science Simulations / https://www.airconsole.com/#!play=com.n ... obotrumble - Robot Rumble on AirConsole
B
45
S
11
G
20
Posts: 363
Reputation: 14,174

Post » Sat Jun 03, 2017 6:01 pm

@cjbruce I say keep the wheels, create a new vehicle version and write a function to switch between the two. First reason is for performance (if slow), the other is for different vehicle-looks after consuming power-ups :-) if the game has such an intention. A little bit of product differentiation goes a long way.

cjbruce wrote:... has to do with positioning/rotation of the visual elements. I should be able to parent them to the body and do rotation about a local axis, shouldn't I?

Gosh. Imagine designing a wide variety of vehicles like this as opposed to having a 3D modeller design and rig it, you use a single Object3D and have it's children transformable whenever needed. The division of labor is also clear cut.

But I digress, parenting not working for you?

BTW. Nice game!
Last edited by fuego96 on Sat Jun 03, 2017 11:10 pm, edited 1 time in total.
I don't need a better iPhone, I need to be better.
B
23
S
9
G
20
Posts: 67
Reputation: 11,736

Post » Sat Jun 03, 2017 10:45 pm

fuego96 wrote:Gosh. Imagine designing a wide variety of vehicles like this as opposed to having a 3D modeller design and rig it, you use a single Object3D and have it's children transformable whenever needed. The division of labor is also clear cut.

But I digress, parenting not working for you?

BTW. Nice game!


Thanks for the encouragement! I'm hoping it turns out well so that more people see html5 as a viable alternative for 3D.

I will definitely take a look at parenting again. It should work, its just that each time I tried, it came out wonky.

I realized after the first version of Robot Rumble, people weren't as interested because I tried to do all of the artwork myself. This time I have a professional 3D artist on the project, and I'm really excited to see how it goes!
www.simbucket.com - HTML5 Science Simulations / https://www.airconsole.com/#!play=com.n ... obotrumble - Robot Rumble on AirConsole
B
45
S
11
G
20
Posts: 363
Reputation: 14,174

Post » Sun Jun 04, 2017 8:35 pm

Solved it! The problem with parenting and setting transform = Yes is that I had initially scaled the laser body model in x,y, and z. This meant that the motors were also scaled in x,y,z and came out elliptical instead of round. All I had to do was to scale each motor/wheel by the same amount whenever I created them. The correct order of operations is:

1. Create a "laserwheel".
2. Set it to the correct position on the laserbody.
3. Change the laserwheel's parent to "laserbody", with Transform:Yes.
4. Set the laserwheel's local object scale to the same ratio of Sx, Sy, and Sz as the laserbody. In this case, (self.Sx*1, self.Sy*0.6, self.Sz*0.7).

Now that everything is parented correctly, it takes a single event running each tick to correctly rotate each wheel and motor about its local y axis. This cut the CPU usage for these events by 80%.
www.simbucket.com - HTML5 Science Simulations / https://www.airconsole.com/#!play=com.n ... obotrumble - Robot Rumble on AirConsole
B
45
S
11
G
20
Posts: 363
Reputation: 14,174

Post » Mon Jun 05, 2017 2:09 am

@cjbruce

Parenting should work fine, you just have to be careful with the transformations because it gets complicated! There's no need to manually shift things like that and it is quite expensive. I see you've fixed it already though
B
75
S
13
G
8
Posts: 1,973
Reputation: 9,841

Post » Wed Jun 07, 2017 3:14 pm

Eh... I'm trying to rotate a collider mesh (no model) but am getting strange results. Is it just me?
Does this (video below) happen to anyone else?

Image

Would appreciate any explanations as to why this happens.
Last edited by fuego96 on Thu Jun 08, 2017 10:28 pm, edited 2 times in total.
I don't need a better iPhone, I need to be better.
B
23
S
9
G
20
Posts: 67
Reputation: 11,736

Post » Thu Jun 08, 2017 11:42 am

fuego96 wrote:Eh... I'm trying to rotate a collider mesh (no model) but am getting strange results. It's just me?
Does this (video below) happen to anyone else? Really small .capx test file included below.

Would appreciate any explanations as to why this happens.


I saw this problem as well when trying to apply a manual rotation to a physics object. I ended up just ignoring it and working around it.
www.simbucket.com - HTML5 Science Simulations / https://www.airconsole.com/#!play=com.n ... obotrumble - Robot Rumble on AirConsole
B
45
S
11
G
20
Posts: 363
Reputation: 14,174

Post » Thu Jun 08, 2017 5:43 pm

cjbruce wrote:...I ended up just ignoring it and working around it.

It's "workaround-able" for some games but can introduce far-reaching inefficiencies for others. I think the real question is, is rotating by a local axis -- which should have been a problem-free instruction -- even "advised" or not.

By "advised" i really mean robust, or should I just treat it simply as a non-existent function and move on?. There are a few things I'm seeing but don't have an IQ of a thousand or more.

So, if anyone can correlate why the rotations are only okay at angles 3, 6, 9, 12 etc., as can be seen here, then you're a genius (maybe). Basically values in multiples of 3 (integer) or pi multiplied by another integer.
Image
Last edited by fuego96 on Thu Jun 08, 2017 6:08 pm, edited 1 time in total.
I don't need a better iPhone, I need to be better.
B
23
S
9
G
20
Posts: 67
Reputation: 11,736

Post » Thu Jun 08, 2017 6:04 pm

fuego96 wrote:
cjbruce wrote:...I ended up just ignoring it and working around it.

It's "workaround-able" for some games but can introduce far-reaching inefficiencies for others. I think the real question is, is rotating by a local axis -- which should have been a problem-free instruction -- even "advised" or not.

By "advised" i really mean robust, or should I just treat it simply as a non-existent function and move on?. There are a few things I'm seeing but don't have an IQ of a thousand or more.

So, if anyone can correlate why the rotations are only okay at angles 3, 6, 9, 12 etc., as can be seen here, then you're a genius (maybe). Basically values in multiples of 3 (integer) or pi.
Image


Another really weird thing I found is that it was computationally three times as expensive to set rotation than to apply a torque to achieve the same effect. I ended up using torques instead of setting angles for all physics objects.

I have no idea what is going on with the uneven angles though. It is just plain bizarre.
Last edited by cjbruce on Thu Jun 08, 2017 7:24 pm, edited 2 times in total.
www.simbucket.com - HTML5 Science Simulations / https://www.airconsole.com/#!play=com.n ... obotrumble - Robot Rumble on AirConsole
B
45
S
11
G
20
Posts: 363
Reputation: 14,174

Post » Thu Jun 08, 2017 6:16 pm

cjbruce wrote:...I ended up using torques instead of setting angles for all physics objects.
I have no idea what is going on with the uneven angles though. It was just plain bizarre.


My last resort is to use torque (maybe), which, is rather overkill for a statically placed wind-turbine providing one among many other hazardous obstacles for the player vehicle (for a game I'm working on).

And the effin' angles... yes. I'm still trying to figure that out. Even if i made a 3D floor tile in Blender3D, duplicated a few, rotated them and wrote down each tile's X, Y, Z rotation on a piece of paper, then input them into Q3DModel as values for rotations, they don't visually appear the same either.
I don't need a better iPhone, I need to be better.
B
23
S
9
G
20
Posts: 67
Reputation: 11,736

PreviousNext

Return to Completed Addons

Who is online

Users browsing this forum: No registered users and 4 guests