#the default method:

1 messages · Page 1 of 1 (latest)

upper sapphire
#

so

clear wigeon
#

yeah

upper sapphire
#

is this the face that is oriented correctly?

#

the face or the side as you wish

upper sapphire
#

and I assume the one behind is "inside out" ?

clear wigeon
#

this is from the other side, none are visible

clear wigeon
#

while they should all be facing pretty much outwards

upper sapphire
#

ok so all these bedrock, redstone and blue text display are essentially like a group (a single thing), right?

clear wigeon
#

they are indicative blocks of whether everything is correctly rendered

#

the text displays are what actually renders

upper sapphire
#

ah okay

#

and this fillUp method is what generates these blue text displays?

clear wigeon
#

yeah

clear wigeon
upper sapphire
#

I assume fillUp is called six times, once for each face?

clear wigeon
#

yeah

upper sapphire
#

show the entire fillUp method and also where you calll it

#

you can send screenshots, nobody will copy paste it anyway

clear wigeon
#
private void fillUp(Vector3f overallCenter, ItemDisplay owner, Vector3f ownerPos, Color color, Vector3f p1, Vector3f p2, Vector3f p3, Face face, World world, float pitch, Transformation transformation) {
        int blockCount = 8;
        Vector3f v1 = new Vector3f(p2).sub(p1).div(blockCount);
        Vector3f v2 = new Vector3f(p3).sub(p1).div(blockCount);

        for (int i = 0; i < blockCount; i++) {
            for (int j = 0; j < blockCount; j++) {
                Vector3f pos = new Vector3f(p1)
                        .add(new Vector3f(v1).mul(i))
                        .add(new Vector3f(v2).mul(j));

                //owner.addPassenger(spawnInwardFacingPassengerDisplay(world, color, ownerPos, pos, pitch, transformation, face.getFaceCenter(), overallCenter));
                owner.addPassenger(this.spawnPassengerDisplay(face, world, color, ownerPos, pos, pitch, transformation));
            }
        }
    }
#
    @SneakyThrows
    private TextDisplay spawnPassengerDisplay(Face face, World world, Color color, Vector3f carrierPos, Vector3f selfPos, float pitch, Transformation transformation) {
        TextDisplay e = world.spawn(new Location(world, selfPos.x, selfPos.y, selfPos.z, 0, pitch), TextDisplay.class);

        Vector3f translationCopy = (Vector3f) transformation.getTranslation().clone();
        translationCopy.add(selfPos).sub(carrierPos);

        Vector3f scale = new Vector3f(2.5f);
        Transformation transformationCopy = new Transformation(translationCopy, transformation.getLeftRotation(), scale, transformation.getRightRotation());

        e.setBackgroundColor(color);
        e.setTransformation(transformationCopy);
        e.setAlignment(TextDisplay.TextAlignment.CENTER);
        return e;
    }
#

Vector3f translationCopy = (Vector3f) transformation.getTranslation().clone();
translationCopy.add(selfPos).sub(carrierPos);
is due to there being a single carrier where each text display rides it and has its transformation adjusted

upper sapphire
#

wait so you attached all these text displays for each side on some entity? so 6 entities each has 64 text display passengers?

clear wigeon
#

no

#

there is 1 carrier

upper sapphire
#

show the method where you call fillUp pls

clear wigeon
#

so 1 carrier has 383

#

v

upper sapphire
#

gosh that's so much code

what's the Face ?
is it an enum?

upper sapphire
#

it's okay dw

clear wigeon
upper sapphire
#

aand what is Direction?

clear wigeon
#

(it's probably incorrect, but we can differentiate between the faces this way)

#

so only 'down' is correct

#

but not entirely

#

since it's in the correct position, but doesn't render from the other side

upper sapphire
#

omg 😭 figure out how FRONT, BACK, LEFT, RIGHT correlate to positive/negative x/z

then when you have the Transformation of each individual text display, for these four faces set it to one of this: java Quaternionf rot = new Quaternionf(); new Matrix3f().rotateY((float) Math.PI).get(rot); transformation.setLeftRotation(rot);

upper sapphire
#

yes because it has to face against where you look it from

#

press f3+b to see where it's facing

clear wigeon
#

I think any yaw changes to it would rotate it around the passenger's loc

clear wigeon
clear wigeon
upper sapphire
#

my bad you need to use rightRotation instead of left

clear wigeon
#

what if I already have a right rotation assigned?

upper sapphire
#

note that where the entity faces is not the same as where the text is facing

#

give me a sec

#

I'm having trouble understanding how to convert angle axis form into quaternion because Transformation.setLeftRotationexpects a quaternion

upper sapphire
#

alright here are the quaternions for leftRotation ```java
// facing positive X
[0f,0.7071067811865476f,0f,0.7071067811865476f]
// facing negative Z
[0f,1f,0f,0f]
// facing positive Z (default)
[0f,0f,0f,1f]
// facing negative X
[0f,-0.7071067811865476f,0f,0.7071067811865476f]

#

facing positive Z means you should look towards negative Z to be able to see the text

#

I'll have to look at how to get them nicely by pi, 2pi, 3pi rotations around Y axis

clear wigeon
upper sapphire
upper sapphire
# clear wigeon

there's so many arguments I cannot keep track of which is which
but here in fillUp you pass a Transformation as the last argument

this will look ugly but you could make a switch (face) inside the for loop then call setLeftRotation(new Quaternionf(...)) based on the face

clear wigeon
#

yeah my methods are not working

upper sapphire
clear wigeon
#

it's not

#

I set their yaw & pitch

#

and uh

clear wigeon
#

pops u[

#

it rotates the entity around the carrier's location

upper sapphire
#

I mean if you're not scaling any of these, you should only touch left or right rotation, and leave the other one as default (identity matrix)

upper sapphire
#

do not change yaw and pitch of textDisplays

clear wigeon
#

Understood.

upper sapphire
#

i mean you could but then do not use transformations (except for up/down facing ones)

#

now I may be wrong here but in most cases left rotation is only what you want, right rotation is just going to skew (e.g. turn a cuboid into paralelepiped)

#

just realised that changing yaw and pitch works for text displays too lol

sorry @clear wigeon in this case you can just change yaw to -180f, -90f, 0f, 90f

clear wigeon
#

I just told you

upper sapphire
#

I'm not sure why didn't it work for you earlier then

clear wigeon
#

that it breaks

#

cuz they are riding an entity probably

upper sapphire
#

combining entity rotation & text display rotation is just terrible

clear wigeon
#

it just rotates them around that

upper sapphire
#

set their yaw and pitch to 0, 0 then and apply rotation within the Transformation ?

#

that should work

clear wigeon
#

rotate leftRotation?

upper sapphire
#

I just tested in singleplayer using commands: when text display A is riding on a test display B,
(A is passenger, B is carrier),
changing B's yaw and pitch does not affect A's yaw and pitch

upper sapphire
upper sapphire
#

when the text displays are translated through a Transformation, text's actual position in the world is offset from the entity's position
so if you go and change entity's yaw and pitch, the text would move around too

upper sapphire
clear wigeon
upper sapphire
#

for UP and DOWN you will need two more quaternions, I'd leave that up to you

#

but yeah that looks good

clear wigeon
#

doesn't

#

wor

#

k

upper sapphire
#

inside spawnPassengerDisplay?

clear wigeon
clear wigeon
upper sapphire
#

okay nevermind

#

let me analyse this code a bit

#

are you sure face.direction is correct and not the same for all faces?

upper sapphire
clear wigeon
#

it will be all white

upper sapphire
#

huh?

clear wigeon
upper sapphire
#

oh

clear wigeon
upper sapphire
#

that's alright

#

I didn't notice it sorry

clear wigeon
clear wigeon
#

otherwise breaks

upper sapphire
#

where would initial left or right rotation come from if not this?

#

that may be what confused me the entire time

clear wigeon
#

I simulate generating a block display

upper sapphire
#

it sounds like you got a rightRotation from somewhere else too and those two combined

#

btw if you'd like to debug each one separately, you can:
instead of java owner.addPassenger(this.spawnPassengerDisplay(face, world, color, ownerPos, pos, pitch, transformation));do this:java TextDisplay ent = this.spawnPassengerDisplay(face, world, color, ownerPos, pos, pitch, transformation); ent.addScoreboardTag("_" + face.name() + "_" + i + "_" + j); owner.addPassenger(ent); then in game /data get entity @e[tag=_UP_0_0]

clear wigeon
#

and wish to, in its place, render text displays as to show a custom texture

clear wigeon
upper sapphire
#

do you really need a rightRotation though?

clear wigeon
#

yes

upper sapphire
#

what for?

clear wigeon
#

not sure

#

it's a bit too long to explain that now xd

#

same with why they need to be a passenger

upper sapphire
#

if you want to rotate everything at once, like this #help-development message
you probably should not use rightRotation, but instead combine the global rotation (for the entire thing) with each textDisplay's local rotation (which is different for each side)

#

(I think multiplying the Direction.leftRot(...) on the left and the global rotation on the right will result in a correct quaternion, but not sure)

#

also I'm going to sleep now, hope you will manage to figure it out

#

cheers o/

clear wigeon
#

gn

clear wigeon
#

Btw @upper sapphire I couldn't manage to do it

#

Just to let you know

upper sapphire
clear wigeon
#

I completly changed my tactic for rendering and hadn't tested with text displays yet

#

I'll let you know once I test whether I'm smart enough for this stuff