R0J0hound's Recent Forum Activity

  • Here's the example:

    * You can load multiple textures and multiple obj files.

    * The object files need to have UVs. It will fail without them.

    * Look at the capx for a usage example.

    dropbox.com/s/71krjzb1heqp8qa/rojo3dwip.capx

    To make it work in C3's C2 runtime, you'll need to change cr_getC2Runtime to cr_getC3Runtime, and c2_callFunction to c3_callFunction i'm pretty sure. You'll need to change them in rojo3d.js and in the start of layout event. Also, jquery is needed for this to work. I haven't looked into what to change for the new runtime to work with this.

  • You can access specific objects by their iid in expressions like so:

    Sprite(0).x gets the first sprite’s x

    Sprite(1).x gets the x from the second sprite.

    So say you have four instances you can access their x’s with

    Sprite(0).x

    Sprite(1).x

    Sprite(2).x

    Sprite(3).x

    Not only that but the number wraps around so you can use 4 to access the first one again.

    So what that expression is doing is it uses the variable t to specify a location between instances.

    For example with a t of 1.33

    It takes instance 1 and instance 2 and uses lerp to find the location a third of the way from instance 1 and 2.

  • Sorry for the late reply.

    This example is probably not the best approach to do what you want. It renders to to a separate canvas which is then copied to a texture on c2’s canvas, and that is used instead of an objects texture. Multiple different objects would just mean doing that multiple times for each model.

    The pro is it lets you draw it in order with other construct objects.

    The con is copying textures can be slow when you do it a lot.

    The construct version specific stuff would be getting the object by uid and changing its texture. That and the calling of event functions from js. For the c2 runtime in c3 it should be enough to just change all occurances of c2 to c3. That, and you need to make sure jquery is included as you’ve already figured out.

    For the new runtime you’ll need to consult the ask manual to see the new ways to do things.

    A plugin would basically do the same thing. You could then hide a lot of the behind the scenes stuff if done right.

    In all reality I’d say the best way to be able to make a simple 3D plugin would be:

    1. Make some simpler plugins to get familiar with what’s involved.

    2. Do some simple webgl programs outside of construct. It’s a pain but it’s much simpler there. Making it work inside construct just adds complexity.

    3. Next flesh out how you’d do what you want to do. You can’t really remove stuff from plugins without breaking projects. I’ve found it’s easier and faster to flesh out ideas and try stuff with a hybrid approach of running js with the browser plugin. A drawback of this is js errors are a bit more obscure.

    4. At this point you have a good idea of how you want to do things so you can start doing the plugin. There are some design issues though. You are more limited with the things you can do as opposed to js, so you may need to get creative.

    3-4ish. I guess at some point you’ll have to test compatibility with different browsers and such. Idk if there are many things to handle.

    Anyways there are probably other ways, this is just some of my observations.

    I’m probably toward the tail end of 3 with a better example. It is doing what I want, and it’s much simpler to use multiple meshes or textures.

    It won’t ever become a plugin, I find them too limiting and hard to maintain. I also need to test with webgl1, and see what breaks.

    It’s only going to be a c2 capx, with no plans to ever be c3. I don’t have internet on my computer most of the time and c3 doesn’t add anything for me. I can try to shove all the construct2 specific stuff in one spot to make updating for c3 easier but it may not be feasible.

    I’m going to try to do a game or demo with it first before posting it to iron out any activating design issues.

  • It very well may not work since I haven’t tested it.

  • Pretty mesmerizing. Would make a great screensaver.

  • Look at the second answer here:

    stackoverflow.com/questions/14521108/dynamically-load-js-inside-js

    It shows a way to load a script without jquery. Basically create a script element, set the source url, set the onload function, and finally append the element to your html document somewhere.

    That’s probably only the first half of making it work in c3. The c2_callFunction calls need to be changed to c3_callFunction. Also I’d imagine the way to access the objects texture is completely different with the new runtime. That’s just off the top of my head, I haven’t really used c3.

    As I recall the gist of that example is it just renders the 3D with some other library, and then it copies the texture over to an object’s texture in construct.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • It looks like the four sprites are moving in a diamond shape.

    Add an instance variable to the sprite and call it “t”. Set each of the four instances to 0,1,2 and 3.

    Then create another sprite called “node” and place four instances in a diamond shape.

    Then in events you can do this:

    Every tick:

    — sprite: add dt to t

    — sprite: set x to lerp(node(int(self.t)).x, node(int(self.t)+1).x, self.t-int(self.t))

    — sprite: set y to lerp(node(int(self.t)).y, node(int(self.t)+1).y, self.t-int(self.t))

  • Do you literally want a n-dimensional array, or do you want an array that contains values or other arrays?

    For an actual n-dimensional array you could use a 1d array to do it. The size would be width*height*depth*... and accessing would be:

    For 2d

    Y*width+x

    3D:

    (Z*height+y)*width+x

    4d:

    ((W*depth+z)*height+y)*width+x

    And so on

    You’d probably wrap that in a function and you could make it resizeable with a bunch of inserts/deletes to move stuff around.

    For a 4d array you could also just use multiple instances of a 3D array and access it with array(x).at(y,z,w)

    You’ll have to deal with new instance picking if you end up creating more instances, not to mention you’d be limited to adding to the end of one dimension.

    The idea may be extendable for more dimensions. I like the uid idea too, but you’ll have to be more deliberate about setting it up.

    Now the issue with n-dimetional arrays is the amount of memory really blows up the more dimensions you add. Which is why I asked if what you want is arrays that contain values or other arrays, each with their own size. Kind of like a file tree.

    Anyways I’d imagine json might work for that. I don’t know if you can use it as a dynamic data structure or just to access the data since I haven’t used it.

    You could also use a normal array to do the dynamic tree structure. Basically you’d store values in pairs: a type and a value. The type would be either be “value” or “array”, and the value would be anything or the uid of another array. You’d then just use a function to do the reading, writing and any sort of extending/resizing. I guess the main aggravation here are errors. Your lookup should be simple as function.call(“at”, arrayid, x, y, z, w) which would access access each parameter as an array index. The trouble is if it tries to access a value as an array. There you could put put an error, which may be hard to hunt down in events, or just output 0 like normal events do out of range.

    If you ended up making a plugin you can detect where in the event sheet the calls are done, so that may help. There may. E a way to do it with the browser execjs action as well.

    Anyways a few other ideas for you. Personally I’d go the event based route. It’s easier to maintain and update.

  • I see what you mean but I’ve stopped working on plugins.

    You should be able to just use paster to do it. Use the draw texture with uv action and just set the uv’s to be the subimage.

    For example:

    U = xpixel / imagewidth

    It may fail if construct packs that image in the same texture as other frames on export.

  • If it’s consistently wider, maybe just using a smaller width would work when not in preview. I’ve pretty much abandoned this effect so I don’t know what’s amiss.

  • You could reverse it by scaling by 1/scale instead of scale. Or you could store the original position and sizes to instance variables.

  • On your own site? I’d say anything is game.

R0J0hound's avatar

R0J0hound

Member since 15 Jun, 2009

Twitter
R0J0hound has 156 followers

Connect with R0J0hound