# Q3D Tips&Tricks

Post your completed addons to share with the community

### » Tue Feb 24, 2015 2:11 am

I`m currently learning to use Q3DPlugin, since the developers are having their hands filled, i understand they don't have time for better simple tutorials for people that don't know how to use not even the simple basics of it. So,i opened this topic to be used in future as a tutorial for newbys like me , that don't know much of three.js or q3d plugin, and so we will learn more about them , by posting here what we discovered, what problems we have, and how to solve them.

If you have tips, tricks, and other tutorials you can share with new people that want to learn, and don't know what is that java script, please do post here.

Here is the official Three.js examples if you are more advanced in reading and using javascript. http://threejs.org/examples/
We all want to learn it and use it .
i will be posting here all i discover in my learning time, and what mistakes i encountered and how i did solved them.

so here is my first tip : how to keep aspect ration of a 3d sphere, in a simple 2d plane.

First you need the q3dmaster object placed on screen. then u add the model and change the collision mask to sphere, and to resize to model size. when u resize the ball u can set the X,Y (width and height) as you wold do with a normal C2 sprite but also u have to keep in mind everything now is in 3d, u have to worrie about the 3rd axe that is Z so in order not to have a egg shaped sphere or a flat coin, see in general properties the z size of the object, you have to change it as the models overall size in my picture the model size is 20,20 so my model z size should be 20 also other way will get either a flat coin or the egg shaped.

size of ball.png

also for texturing it load ur image that u want to use(works better if the image is set at 512x512 or bigger) and change the animation name of the model to DiffuseMap.

sphere with texture.capx

Thanks to @matriax and @MasterWinyoutube channel

2 more tips and tutorials added to the list

1. How to create a basic Q3D Scene in Construct 2
2. How to Import a Model into Q3d Construct 2

Audio + Q3d Visualisation and some shader FFX that are listed in the description on Arcade game page capx available to download in description.

more will come soon hope it helps you guys !
You do not have the required permissions to view the files attached to this post.
Last edited by gamecorpstudio on Thu Nov 10, 2016 10:05 pm, edited 9 times in total.
B
86
S
26
G
75
Posts: 1,440
Reputation: 47,810

### » Tue Feb 24, 2015 4:01 am

ok so as you see in my first capx. i failed to wrap the diffuse map the right way, if you wold change the colors to lets say something else white background and dot in middle will just create a spot that its stretching across the ball, but as i was looking in some examples of the q3d examples i noticed that they where warping good and couldn't notice why, here it is how you wrap a texture on a sphere. first i used the frame from the balls animation with this sizes not sure if matters or not (width 512, height 256).

Wrap Texture Example Picture

wraptexture.png

ok even if the thread is about tips and tricks, il try updating this second post i did, so it can turn into a easy quick pool ball tutorial in Q3D .

next step il add some normal sprites , the official physics plugin, and a stick to let us hit the cueball and interact with others.

ok so i already added the sprites in the scene, but wait if you start the scene you will see the sprites are not shown that is because the q3dmaster is has the render mode set to in front, if we wold change it to inside, you will see any sprites you placed above in your scene editor. the end result should look like this.

Sprites over Q3dMaster

ok so here it is the simple pool Q3D game you can easy make it.

first i added 15 more balls, created the texture maps for them, (duplicated the cueball, using same .obj but just changed the frame sprite color.), made the settings to match the size and collision size of the cueball so all are same and interact ok, with each other without having a invisible space between them.

http://goo.gl/pVDbp3

AND here is how it should look if you tried to do it yourself.

http://goo.gl/48mBwn

@QuaziGNRLnose thanks for the info, that made me understand better , but in the second post i fixed the issue having a simpler approach by using the events in the physics for the texture wrapping since its a sphere. i tried using the normal map texturing tutorial but its not working for spheres very good.

wanted to use the physics tutorial for this post to create the rolling natural, but when i move the camera above the view its doing some weird actions, as if i want to shoot towards 270 degrees the ball jumps, if i want to shoot towards 90 degrees the ball goes through the floor. maybe is the viewport the fault.. not sure
You do not have the required permissions to view the files attached to this post.
Last edited by gamecorpstudio on Tue Feb 24, 2015 8:32 am, edited 7 times in total.
B
86
S
26
G
75
Posts: 1,440
Reputation: 47,810

### » Tue Feb 24, 2015 6:33 am

you made a mistake in your first post.

You do not set model materials to "yes", if you want a diffuse map on your model using animation frames. Model materials tries to use the materials setup in the JSON model file, and will ignore any settings in construct unless you follow a specific advanced procedure.

For a diffuse map using animation frames there are 3 steps:
1. Set a Q3DModel object to load a properly UV mapped model
2. Make sure model materials is set to "no"
3. Create/Rename an animation to "DiffuseMap" (case sensitive), and draw/import the frames.

Q3D supports animated textures if you follow this way of texturing. the animated textures use the C2 animation properties to animate. Also note that some material types have extra kinds of maps you can set (just by naming one of the animations, or a combination of animations any of these names like we did for "DiffuseMap"):

Phong:
"DiffuseMap"
"SpecularMap"
"EnvironmentMap_ENVRefract"
"EnvironmentMap_ENVReflect"
"LightMap"
"BumpMap"
"NormalMap"

Lambert:
"DiffuseMap"
"SpecularMap"
"EnvironmentMap_ENVRefract"
"EnvironmentMap_ENVReflect"
"LightMap"

Basic:
"DiffuseMap"
"SpecularMap"
"EnvironmentMap_ENVRefract"
"EnvironmentMap_ENVReflect"
"LightMap"

Normal:
(no maps supported)

Depth:
(no maps supported)

Shader (feature not fully supported in V-2.3, but WIP for newer versions):

The other way of defining materials is to do all that in blender following three.js tutorials, and then setting model materials to "yes" and adding the necessary textures you used in blender to the files folder. it's much more complicated, and works in the same way as the workflow of three.js. I'd recommend against using it as it doesn't allow for the same kind of flexibility as using the animation system.

Another note is you can change texture animations at runtime, and have more than one, but you need at least 1 animation named for example "DiffuseMap" (or any of the above) if you want to change the texture animation to something different, or else Q3D will think the model doesn't use any diffuse-maps and wont initialize them on the model, and changing will lead to an error or no effect.

Environment maps work in a special way since they need 6 textures in the shape of a cube to work. If you want to know how they work look at the comments in "texturing model example" capx in the main Q3D post. for Q3D to recognize an animation as an environment map, you need to add "_ENVReflect" for a cubic environmental reflection map, and "_ENVRefract" for a cubic environmental refraction map. the same rule for needing at least one "EnvironmentMap" animation applies here. but additionally other animations need to be called something like "myanimation_ENVReflect" if you want to change environment map animations at runtime, in practice i don't see many people wanting to do this though.

Also to note for Environment maps, "frames" don't exactly work the same since the maps need 6 textures. Every 6 frames in an animation are converted to the faces of the environment map, if you have 12 frames then you'll have two seperate cubic "texture frames", meaning two sets of 6. this is a little confusing to explain, but as you add frames you'll see with 1-6 frames the environment maps doesn't "animate", but with 7-12 it animates between two "texture frames", with 13-18 it animates with three "texture frames", etc. if there aren't enough frames to build a cube, it just copies the last frame over the remaining needed faces.

All this is confusing in words, but if you look at the "texturing model" capx, it should be pretty clear.
B
79
S
13
G
8
Posts: 1,977
Reputation: 9,947

### » Wed Feb 25, 2015 12:29 am

ok so.... omg... finally after 2 days of working with q3d.... and asking so many unclear and stupid questions to the wrong people... i finally found it myself by elimination .... so in order to move a object to an angle on 3d axes into a 3d plane guys.... you need to follow the Q3D viewport &raycaster example, clone the raycaster...into you game... then just take the Q3DRaycaster.x ,Q3DRaycaster.y ,Q3DRaycaster.z that will be your 2d mouse coordinates in a 3d plane.... now to make the change the angle of the object that is a different question because now you cannot use anymore the y axes because y its not moving for same coordonate, its position above your texture or floor or ground in game so u don't want to change that unless you want ur character to jump up.... or go down... under the textures... so we want to use X coordonate and Z coordonate or rz /raycaster z let me test it and il be back if not we have to push the object towards the raycaster coordonates, and fake the rotation towards there, but wont be needed a little push and the ball will roll cause its on physics now
B
86
S
26
G
75
Posts: 1,440
Reputation: 47,810

### » Fri May 15, 2015 7:56 pm

Message: bhain7 can only post plain text URLS until they have 500 rep. 2 URLS modified. Why?
I worked on a tutorial on how to setup a basic scene and import a model file.
http://www.3dswing.com/tutorialsexamples.html

The site has some other info, but not much atm. I also have a video of some of the sample files that I was able to find for Q3d.
http://3dswing.com/samples.html
Also a mobile demo.

Looking forward to the new version to fix exporting. I'm happy to get any feedback, mistakes or requests for new tutorial videos.
Check out http://3dswing.com/ for games (in the works) and tutorials on Q3D plugin for construct 2.
-Masterofwin
B
9
S
2
Posts: 53
Reputation: 664

### » Sat May 16, 2015 8:22 am

Wow , awesome thanks for sharing nice examples i forgot about this topic i did, ) had so much work to do i just dident had time for it! was working on store items but il try do some usefull stuff for people
B
86
S
26
G
75
Posts: 1,440
Reputation: 47,810

### » Mon May 18, 2015 12:30 am

Exactly what I need, thank you guys!
B
76
S
38
G
52
Posts: 504
Reputation: 32,292

### » Mon May 18, 2015 4:27 am

bilgekaan wrote:Exactly what I need, thank you guys!

il post soon some cool things that will make a good use of the new q3d physics and use it easy actually works the same as the normal physics behavior, just the stuff you can do now its insane c2 now is a 3d engine and easy to use
B
86
S
26
G
75
Posts: 1,440
Reputation: 47,810

### » Mon May 18, 2015 3:33 pm

This is great - Thank you for all your hard work. I have been fighting with this plugin. I can tell it's very powerful - it's just getting my head around it.
B
12
S
2
Posts: 15
Reputation: 1,084

### » Mon May 18, 2015 4:15 pm

@gamecorpstudio and everyone making tutorials for Q3D, thank you very much. Haha first time I bought it, I didn't know how to use it and the instructions at that time were very technical and complex for me. I'm now working on other games at the moment, but it is nice to know that once I got the time, there are tutorials there for me to learn it visually.
B
46
S
23
G
31
Posts: 693
Reputation: 20,637

Next