Creating Sprite Projection Attachment Points With 3D Objects

0 favourites
  • 3 posts
From the Asset Store
Welcome! I-Spy (Hidden objects) is an educational puzzle that is more than just seek-and-find activities.
  • Hello all,

    My first post on the forum here! I started using Construct 3 a short while ago to explore the viability of creating a grid-based strategy combat game. I built a prototype in another event-based coding tool (GDevelop), but I ran into some frustrating performance problems. Hoping to overcome those in Construct and, thus far, that has been the case.

    I initially scoped the game in 2D, but I love the 2.5D aesthetic in Construct. However, I've run into some challenges with creating projection sprites and attachment points to replicate what I accomplished in 2D.

    Goal: A key aspect of the game is a modular character builder which dictates abilities, attacks, and overall stats. There are four components - Body, left arm, right arm, and a head. In my prototype I designed the modularity using a system of attachment points which follow a hierarchy based on an invisible player object. Easy enough to replicate in Construct using only 2D, but I've not been able to translate that into 3D using sprite projections.

    Here's a screenshot of my prototype built in GDevelop and my current Construct 3 project just to give you a visual idea of what I'm talking about:

    Prototype

    Current Construct Build

    With the background covered, I have a few related questions.

    Is it possible to select a specific instance of an object for a 3D face to use as a face object?

    • Context: Ideally I only need one Sprite object for each selectable part for the Player and Opponent. Seeing as there are conceivably a lot of parts, I store each selection as a different animation which is then updated when a specific instance variable is noted in the instance. EX: Condition - Every Tick | If Sprite instance variable Role is "player" Action - Update to animation based on a global variable of the selection. Same applies to the opponent. Saves me from duplicating work in two identical 'Opponent' and 'Player' sprite objects.

    When an instance of an object is being used as the face of a 3D object can I use the attachment points of that instance?

    If no to the above question, is it possible to create an attachment point for a 3D object face?

    • I may be missing something here, but I could not find a way to add new attachment points even though there was an interface in the image editor for doing so.

    If no to everything above, is there some feature I am missing in Construct that would allow me to implement my intended functionality?

    Thanks all for your time! Looking forward to diving deeper into this engine's community as I work on this project.

  • Is it possible to select a specific instance of an object for a 3D face to use as a face object?

    Yes, you just need to pick a specific instance to use with conditions.

    When an instance of an object is being used as the face of a 3D object can I use the attachment points of that instance?

    Just the image is used when setting the face of a 3d shape. You’d have to calculate that from scratch.

    For example, a unrotated 3dshape with its origin at the bottom center, with the front face set from a sprite. You can then calculate the image point location on the front face with something like:

    ipx = (sprite.imagepointX(1)-sprite.bboxLeft)/sprite.width
    ipy = (sprite.imagepointY(1)-sprite.bboxTop)/sprite.height
    X=3dshape.x +(ipx-0.5)*3dshape.width
    Y=3dshape.y +0.5*3dshape.height
    Z=3dshape.zelevation+ipy*3dshape.zheight

    If the 3dshape is rotated that would be another step:

    NewX = (x-xcenter)*cos(angle)-(y-ycenter)*sin(angle)+xcenter

    NewY = (x-xcenter)*sin(angle)+(y-ycenter)*cos(angle)+ycenter

    Anyways, that’s roughly how it can be done. You’d pick a sprite to use as the front face, set the front face, and calculate the position from that picked sprite on the front face.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Exactly what I was looking for! Thank you, R0J0hound.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)