R0J0hound's Forum Posts

  • I may be overthinking it but when two objects overlap there isn't typically a single contact point but an overlapping area. If the collision shapes are convex there may even be multiple areas. A way to find those areas would be to take the collision polygons and applying some clipping algorithm to that, but that's not very trivial to do.

    As a second phase you could then find the midpoint of those areas to give you a single point.

    Alternately you could utilize an algorithm called the Separating Axis Theorem (SAT) to push the objects apart to just be touching and find that point. If the shapes are concave then it would be more complex to handle. This is also a bit involved to make.

    Another idea is to utilize something like a raycast. Check the points from the hilt to the tip of the blade to see if any collide. As soon as one does, stop checking more and use that point. You could use the condition "pick object overlapping point" to do the point collision checks, or you could use a small detector sprite that you place along the sword.

    Anyways here's the point example way to do it. The sword has it's origin at the hilt and an imagepoint at the tip.

    on sword collides with enemy
    repeat 10 times
    pick enemy overlapping point (lerp(sword.x, sword.imagepointX(1), loopindex/9), lerp(sword.y, sword.imagepointY(1), loopindex/9)
    --- stop loop
    --- create particles at (lerp(sword.x, sword.imagepointX(1), loopindex/9), lerp(sword.y, sword.imagepointY(1), loopindex/9)
  • One way you could do it is utilize log10() to find the number of digits of a number.

    Var number
    Var d
    Set d to int(log10(number)/3)
    Set text to int(number/10^(d*3)*100)/100 & mid(" kmbt", d, 1)

    So something like 123456789 would result in 123.45m. It works up to the trillions (t) but to handle higher numbers you’d have to add to the text in the mid expression.

  • You do not have permission to view this post

  • You can render to frames and import the frames as a 2d animation.

    There is also a third party plugin by mikal to load gltf files to display the 3D models with c3’s 3D. It also lets you play back animations in them.

    So if you can export gltf from maya that may be an option.

    Zbrush is the same deal. Just use a rendered image or export a gltf file to use with that plugin.

    So try out those options to see if what you want to do is doable in construct.

  • I don’t think they let you change the fov yet. You can switch between perspective and orthographic projection but that’s about it.

  • Here's one way to do it. You place sprites in order to make the path. Then as time passes they are made visible. An added nice feature is to draw lines between the points, as well as to a sprite moving along the path.

    dropbox.com/s/48gr76yk5flvasa/drawPath_overTime.capx

    This example only does one path. To do multiple paths the events would have to be tweaked.

  • megatronix

    I’m still running off memory here.

    I’m pretty sure the layers take either a number or a base16 string(hex). Or just hex in the properties toolbar. I forget if it let you use base2 strings which would be 32 ones or zeros in a string.

    Anyways I’d say try using a number with setbit() with your events to set the layers. Something like:

    Var layers=0

    Repeat 32 times

    Some condition

    — set layers to setbit(layers, loopindex)

    Anyways that’s my the idea at least.

  • It happens because qarp is a Bézier curve and b is a control point that the curve won’t ever touch.

    But you can take the equation and find the control point so that b is on the curve.

    stackoverflow.com/questions/6711707/draw-a-quadratic-b%C3%A9zier-curve-through-three-given-points

    X=qarp(xa, 2*xb-xa/2-xc/2, xc, t)

    Y=qarp(ya, 2*yb-ya/2-yc/2, yc, t)

    Alternatively you can utilize another kind of spline curve such as hermite or catmull-rom which always passes the curve through the points.

  • I often forget about how things work in the stuff I make. I’m just decent at figuring it out should I have time and access to a computer to try stuff out. But I haven’t been on a computer for weeks now.

    Anyways I don’t recall what values the the layers parameters take. Is it a number? A hexadecimal string? A binary string? I’d have to check, either by trial and error or looking at the tooltip text that shows up when selecting that field.

    I’m guessing If it’s working for only 8 then it’s in hexadecimal since 8 hexadecimal characters is 32 bits.

    I guess you could build the string up as binary first and convert it over to hex. Or maybe the action lets you supply a number instead of text you could use a number you set with the setbit() expression. I honestly don’t recall though. This is all off the top of my head.

  • You mean just get rid of the quotes?

    Set text to replace(text, """", "")

    Set text to "str("&text&")"

    Or do you mean just evaluating the formula in a string?

    Sounds like you already are utilizing execjs() to run it like a JavaScript expression, but want different syntax with pow and such.

    In which case I want to revise my previous reply. I’d recommend writing a parser. Or don’t. Just search for the newest posts by me where I mention parser and use one of those capx.

  • At a glance I’m not super sure what I’m looking at. What’s not working?

    I’m guessing you’re intension is to have the scene divided into 32 z slices and set the layers depending on which ones the object is in?

    In which case I’d say look at your formula and see if it’s doing what you think it should be doing. If it isn’t then I’d say try re-thinking the approach. Best case you just made a typo somewhere.

  • Maybe this? It would give the angle above the ground plane.

    Angle(0, Obj1.zelevation, distance(obj1.x,obj1.y,obj2.x,obj2.y), obj2.zelevation)

  • This topic here shows a way to bend text:

    construct.net/en/forum/construct-3/general-discussion-7/text-follow-curved-path-157571

    It divers the text up to make an object per character and uses the .textWidth expression to get the size. Then just places them along a path using cubic() as I recall.

    An alternative way could be to utilize a distort mesh instead.

  • Guess I can’t play mkv files from my phone. Anyways, will look later in the week if I get on my pc.

    I’m going to stick with the 0-1 for color values I think. You can divide values in the range 0-255 by 255 as a easy conversion.

    Depending on the shadow issue you can improve it by adjusting the shadow bias or using a bigger shadow map size. But I’ll see better when I get to watching the file.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You can make a parser to do it. There are many ways to do that depending on what you want to do.

    Fist step is to get a list of tokens (numbers and +- or ^)

    A simple way to do that is with a series of replaces so what you end up with is a list of tokens divided by spaces.

    Then you can loop over them and make that substitution with something like this:

    var text = "2^3+4^6
    
    Set text to replace(text, “ “, “”)
    Set text to replace(text, “+”, “ + “)
    Set text to replace(text, “-“, “ - “)
    Set text to replace(text, “^”, “ ^ “)
    
    var output= ""
    var i=0
    var n=tokencount(text, " ")
    
    while i<n
    -- add 1 to i
    -- if tokenat(text,i," ")="^"
    -- -- add "pow("&tokenat(text,i-1," ") &","&tokenat(text,i+1," ")&")" to output
    -- -- add 2 to i
    -- else
    -- -- add tokenat(text,i-1," ") to output