R0J0hound's Forum Posts

  • I did a breakdown of the units of the physics behavior here:

    Basically the units that the physics library that C2 uses is based on SI units. This is the ratio of pixels to meters:

    50 pixels : 1 m

    But when you set the gravity that's in m/s^2 so you can just set it to 9.8.

  • Hi,

    It's still on my dropbox but all my links are broken because of a dropbox change. Anyways I updated the link.

  • Here's an updated capx with obj file loading.

    https://www.dropbox.com/s/dbehcd1aestt0 ... .capx?dl=0

    The obj files need to have triangulated faces, and uvs and normals in them as well. The texture files also should be flipped vertically.

    Edit:

    Another slight update: it can update the textures of tiledbg and particles as well as sprites now.

  • It's another simple library to help make webgl less verbose. Threejs or babylon3d are kind of bulky since we won't use most of it. For minimum size just webgl could be used.

  • Yeah, that's what I mean by an obj file parser. The idea would be to include an .obj file in the project and have it read all the vertices and faces from that. Anyways, that may be a while before I do something like that. I'm mostly done for the day.

  • The specific code that creates the cube is in the mycode.js file in the project files folder.

    var arrays = {
          position: [1, 1, -1, 1, 1, 1, 1, -1, 1, 1, -1, -1, -1, 1, 1, -1, 1, -1, -1, -1, -1, -1, -1, 1, -1, 1, 1, 1, 1, 1, 1, 1, -1, -1, 1, -1, -1, -1, -1, 1, -1, -1, 1, -1, 1, -1, -1, 1, 1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, -1, 1, -1, 1, 1, -1, 1, -1, -1, -1, -1, -1],
          normal:   [1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1],
          texcoord: [1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1],
          indices:  [0, 1, 2, 0, 2, 3, 4, 5, 6, 4, 6, 7, 8, 9, 10, 8, 10, 11, 12, 13, 14, 12, 14, 15, 16, 17, 18, 16, 18, 19, 20, 21, 22, 20, 22, 23],
        };[/code:3q5ffq96]
    A parser for something like the obj file format would be more manageable.
  • newt

    Probably, the loading is done with an ajax request and it can know when it fails. I'm not updating plugins now though.

  • Here's demonstration of a way to run some webgl and display the result on a sprite (not minifier friendly):

    https://www.dropbox.com/s/iq4xmleoeqkb1 ... .capx?dl=0

    It may be useful as a base to do what's asked for in the op.

  • To get it to work in preview mode with nwjs here is a strategy I've used.

    global text appfolder="c:\myfolder"

    Start of layout

    [negated] is preview

    --- set appfolder to nwjs.appfolder

    Basically, if you're in preview just use a direct folder path, otherwise use the nwjs.appfolder expression.

  • If you use the nwjs export/preview you can use the readfile expression of the nwjs object to read a local file.

    For a normal HTML preview the browser should prevent access to local files. If you export as html you should be able to access files in that same folder if you just use "nomes.txt".

  • I probably rambled too much. Maybe this is helpful?

    https://www.scirra.com/manual/141/files

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If you added the files from inside c2 the second should work. There's also the "request project file" action.

    I said "from inside c2" because I'm not sure just adding the the files in your project folder from Windows explorer is enough. I think there's an xml file the c2 uses to list the files, but c2 takes care of that when adding the files from the editor. If you are using the editor to add the files then disregard.

  • It's possible in c2. The simplest way would be to find a Babylon3d or q3d example that just loads and displays a model, then just load that in the iframe plugin I'd guess. I'm refering to the actual JavaScript libraries and not the plugins.

  • I think the server the file is on needs to allow an Ajax request or I think the wording is cross domain requests. Typically I just put files in the files folder of the project and not worry about it. You should also be able to upload the file the same place you uploaded your html export to. Although I guess you're using some other kind of export.

    I think there is an "on error" condition in the Ajax object that could be used to probably get an error message. You could also see if there's any settings you can set for the server you uploaded to? My guess is unless it's your own server you won't have control over that. Or maybe just try uploading somewhere else?

  • I'm not sure that link would help.

    You can do the projectile motion by giving the ball two variables: vx and vy

    Then the motion is done with one event:

    Global number g=100

    Every tick

    --- ball: add g*dt to vy

    --- ball: set y to self.y+self.vy*dt

    --- ball: set X to self.x+self.vx*dt

    g is the gravity value. Next you can do bouncing with:

    Ball overlaps head

    Ball: vy>0

    --- Ball: set vy to -self.vy

    --- ball: set vx to g*(otherhead.x-self.x)/(-2*self.vy)

    So that will make the ball bounce back up to basically it's original height and vx is set so the ball will land on some other head.

    That formula can be found by using these two projectile motion equations:

    Y=y0+vy*t+0.5*g*t^2

    X=x0+vx*t

    Just solve for vx with the simplification of y=y0. Solve it without the simplification if you want the ball to land on different heights.

    On a final note, you can make the height the ball bounces back to by changing the "set y" action to:

    Ball: set y to self.y+self.vy*dt+0.5*g*dt*dt

    And moving the set vy action below it.