R0J0hound's Forum Posts

  • It’s a project property. I think it’s called image filtering or sampling or something like that. By default it’s linear but you want nearest. I think you may be able to change that per layer but I’m not sure.

  • You could set the camera angle to mouse.x or something. I’m guessing you might have something else in mind but I’m not sure.

    I know there are examples elsewhere on the forum of setting the 3d camera in different ways that could be adapted I suppose. However in this example I’m only supporting setting the camera with the look at action.

  • Here is an update that changes the view from the camera object's position and angle and looks down a bit. Also added some controls to move rotate and strafe.

    There are many ways to set it up so I just picked one and went with it.

    dropbox.com/s/r4g7r0x6ty782zx/cube_raycast2.c3p

  • I just replicated the “look at” action. If any of the other actions that move or change the orientation of the camera are used then they would need to be replicated too.

    Currently the orientation is a 3x3 matrix stored in three sprites. It can be rotated by multiplying with a rotation matrix that rotates the amount you want to rotate. In practice we’d use some simplification of that.

    Another way that may be simpler would be to only use the “look at” action to orient the camera. Just change the look at target.

    X: camera.x+100*sin(a)

    Y: camera.y+100*cos(a)

    Z: camera.z

  • I mean there are only two speakers so the volume is balanced between those two for any direction. Option two seemed simpler when I wrote it. I tend to try that a lot. When construct doesn't have a feature I try to calculate it manually and then somehow work that in to the available features.

    You can probably get some basic overview on how to use JavaScript in construct with a few of the tutorials available. There are lots of ways and none of them seem very clean to me. Anyways, the meat of using the webaudio api to do the audio is to setup a node graph. Rough overview of how it would look is this:

    source1->gain->position--+
    source2->gain->position--+->listener->gain->output
    source3->gain->position--+

    Basically any sound you want to play would need to be added to the graph with a gain node. Then they could be removed as they finish. Of course the nuance of implementing it will look more verbose.

    Anyways, ideally the solution would be simple or added so it can be simple. These solutions are paths to work toward a solution without having to wait on the devs.

  • I can’t wrap my head around a solution to that. As is the impulse corrects the position but as the length is changing the velocities would have to be updated somehow.

    I tried gradually changing the length with a force but haven’t had much success.

  • I don’t think the audio plug-in has been updated with 3d in mind. You could make a feature request to give a z height to the positioned audio since webaudio already has that available, construct just doesn’t use it.

    A second option would be to calculate the volume from the 3d distance to the listener and the falloff equation. It’s mostly just busywork to workout the formula.

    A third option would be to use JavaScript instead to do the audio plugin. There are various libraries that could work or if you could use webaudio directly.

  • There isn’t one way you have to do it. You can set it up any way you like. With any setup you’ll have to do some juggling with events.

    If it’s any consolation I find any changes to this to be complicated too. I attempted to simplify things into manageable chunks but I still find rough to debug or modify.

  • All the code refers to same sprite type. The new choices are a different type.

    I made all the numbers be the same type and used a group variable to differentiate between then to reduce the amount of events.

    There are many ways to setup the events. Currently it does most of the stuff with variables and only deals with sprites when displaying. Nothing is automatic. To display it picks a certain group of sprites and sets it from a certain variable.

  • Here’s the rope joint done with impulses. 100 is the max distance. The /100 at the end was to scale things down.

    dropbox.com/s/bpxf1z9zws5e1t8/Ropejoint.c3p

  • The physics behavior doesn’t provide that joint.

    A few ideas come to mind though.

    1. Is to do event based physics using verlet. I’ve made rope examples that do that. It’s as simple as if the distance is greater than a certain amount the objects are moved toward each other to correct that, then the velocities are updated. The cons are it’s independent of the physics behavior and working with ridged bodies will require more code.

    2. Joints in the physics engine are done with impulses behind the scene so in theory you could make the joint you want with that. I fiddled with the idea a bit and something like an impulse of (distance-100)/100 toward the other object seems to work but is bouncy. For better results we could copy what impulses box2d calculates for such a joint.

    Edit:

    If d is the distance between the objects and ang is the angle between them, then the impulse should be the following when dist<100. At least from what I’ve read.

    ImpulseAtoB= -(d-100+(A.vx-B.vx)*cos(ang)+(A.xy-B.vy)*sin(ang))/(1/A.mass+1/B.mass)

    I’ll test this later. The units may be off.

  • VectorX = speed*cos(sprite.angle)

    VectorY = speed*sin(sprite.angle)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I apologize, I’m not great at reading events at the moment. I thought I had given a solution to your last question in one of the first files I posted. I think I’m causing more confusion with every new capx I post since I do things slightly different over time.

    In the last capx it just makes three shuffled value. If they are all unique (don’t equal each other) then one is picked randomly to be the right answer.

    You could just make two shuffled values and make them unique by comparing with each other and a correct answer.

    I’d recommend doing some tests to swap two values or two positions of objects. Once you can do that you have all the tools you need to shuffle anything.

    In general you could swap a and b with:

    Temp=a

    A=b

    B=temp

  • Yeah, even though I provided the ideas in that screenshot I'm confused by what it does.

    Here's a capx of that pseudo code I posted. To simplify things It uses variables, and functions to organized the steps. The sprites are all the same type and are set as the last step. Again, that was to simplify things and need less events.

    dropbox.com/s/n3ewz0wklyzh26w/shuffle_and_reorder2.capx

  • The issue you’re seeing is you cannot pick two separate instances of an object like that.

    One common solution is to use a family with just that type. But you’d need to only add instance variables to the family.

    For each sprite
    Other: instance = sprite.instance+1
    — create spriteB at (other.x+sprite.x)/2, (other.y+sprite.y)/2

    Another idea is to pick one, save the data you need to variables, use “pick all”, then pick another.

    Var otherx=0
    Var othery=0
    Var otherInst=0
    
    For each sprite
    — set otherx to sprite.x
    — set othery to sprite.y
    — set otherInst to sprite.instance
    — pick all sprite
    — sprite instance = otherInst+1
    — — create spriteB at (otherx+sprite.x)/2, (othery+sprite.y)/2