Drawing content from another canvas onto c2canvas

For developers using the Construct 2 Javascript SDK

Post » Wed Apr 02, 2014 10:35 pm

@quazi - are you sure that's the better way? The second seems more in line with how C2 works. How does picking work if everything is in the same plugin? How could I do something like:

If 3denemyobject variable 'mode' = "patrolling"
If distance(3denemyobject.x, 3denemyobject.y, 3dplayerobject.x, 3dplayerobject.y) < 1000
- set 3denemyobject.mode to "chasing"

If 3denemyobject variable 'mode' = "chasing"
- move 3denemyobject 50*dt pixels at angle: angle(3denemyobject.x, 3denemyobject.y, 3dplayerobject.x, 3dplayerobject.y)
Moderator
B
94
S
33
G
33
Posts: 3,006
Reputation: 27,749

Post » Thu Apr 03, 2014 2:05 am

It's more in line with how C2 works which makes it intrinsically not inline with how three.js works. It would introduce significant overhead to do it with objects outside of the plugin i'd think
B
77
S
13
G
8
Posts: 1,973
Reputation: 9,891

Post » Thu Apr 03, 2014 3:48 am

Ergh, that's frustrating. Depending, though, I think it still might be worth it. C2's event system adds overhead to normal JavaScript as well, but it's still fast enough in most cases (on desktop especially). It might be too confusing for many users to have to adapt to whatever system three.js uses, but then again, I don't know how it works, so I guess it's hard for me to make an informed comment on the matter. I'm just concerned because I've tried normal programming before and it made no sense to me at all.
Moderator
B
94
S
33
G
33
Posts: 3,006
Reputation: 27,749

Post » Thu Apr 03, 2014 4:19 am

i plan to just have most of the functions/methods you would use with three.js implemented as actions, and some way of looping through all the three.js objects/materials, to select them/modify/create/destroy them. It's all just brainstorming right now cause to be honest i'm not entirely certain of what to do yet.
B
77
S
13
G
8
Posts: 1,973
Reputation: 9,891

Post » Thu Apr 03, 2014 5:38 am

Are you going to load models, rigging's, bones, or scenes?

Or is this Thumb Warz Two: Enter the Digits?
Image ImageImage
B
169
S
50
G
169
Posts: 8,286
Reputation: 108,216

Post » Thu Apr 03, 2014 5:00 pm

In my case events looked a lot like:
Code: Select all
Three: Create scene "myScene"
Three: Create camera "myCamera" (fov:30, aspect:windowWidth/windowHeight)
Three: Create CubGeometry "myCube" (10,10,10,1,1,1)
Three: Create BasicMaterial "myMat" diffuse: "0xff0000"
Three: Create Mesh "myMesh" with geometry "myCube" and material "myMat"
Three: Create PointLight "myLight" intensity: "1.0"
Three: Position object "myMesh" at (1,0,2)
Three: Position object "myLight" at (2,5,2)
Three: Position object "myCamera" at (2,5,-2)
Three: Camera "myCamera" lookAt (1,0,2)
Three: add object "myCamera" to scene "myScene"
Three: add object "myMesh" to scene "myScene"
Three: add object "myLight" to scene "myScene"
Three: Render scene with camera "myCamera" and scene "myScene"

At some point I think it's easier to do in javascript directly.... You lose almost all of c2's advantages.
B
66
S
22
G
14
Posts: 1,484
Reputation: 16,511

Post » Wed Apr 09, 2014 7:34 pm

This is exactly why an IDE SDK would make sense...
B
36
S
8
G
8
Posts: 532
Reputation: 6,903

Post » Wed Apr 09, 2014 10:54 pm

Fimbul wrote:This is exactly why an IDE SDK would make sense...


Not for this no, something like this is meant to be controlled at runtime, theres no real difference between a start of layout load and and setting things up in the IDE. Its better to make a standalone editor with exportable files imo than rely on something built into the IDE.
B
77
S
13
G
8
Posts: 1,973
Reputation: 9,891

Post » Thu Apr 10, 2014 2:53 pm

@QuaziGNRLnose
Are you using Three.js as a scene rendered. Where as we use it as an entire world replacement. Yann's sample and who ever did Copperlicht plugin both went the route of world renderers.

Or

Are you using three.js as an alternative Sprite object replacement where the object will remain in a C2 world render?

You can also use Threejs to render to texture instead of canvas.


I'm looking forward to your plugin. I'm hoping I will have some use for it :)
B
90
S
18
G
9
Posts: 2,455
Reputation: 15,018

Post » Thu Apr 10, 2014 8:39 pm

probably a mix of both
B
77
S
13
G
8
Posts: 1,973
Reputation: 9,891

PreviousNext

Return to Javascript SDK

Who is online

Users browsing this forum: No registered users and 1 guest