#Problem with vectors/location offset

1 messages · Page 1 of 1 (latest)

silent token
#
Location asLocation = event.getClickedBlock().getLocation().add(0, 1, 0);
        ItemDisplay display = event.getPlayer().getWorld().spawn(asLocation, ItemDisplay.class);
        asLocation.getBlock().setType(Material.BARRIER);
        display.setTransformation(new Transformation(new Vector3f(0f, 1f, 0f), new Quaternionf(0, 0, 0, 1),
                new Vector3f(2, 2, 2), new Quaternionf(0, 0, 0, 1)));

Can someone explain me why this is offsetting my summoned display... I do not have an understanding of vectors at all so I am extremely confused

neat hemlockBOT
#

<@&987246746478460948> please have a look, thanks.

#

Here is an AI assisted attempt to answer your question 🤖. Maybe it helps! In any case, a human is on the way 👍. To continue talking to the AI, you can use </chatgpt:1108714622413963314>.

#

lay.class);
display.setItem(itemStack);


The problem with this code is that it is missing the closing parentheses for the `add()` method. The correct code should be:

```java
Location asLocation = event.getClickedBlock().getLocation().add(0, 1, 0);
ItemDisplay display = event.getPlayer().getWorld().spawn(asLocation, ItemDisplay.class);
display.setItem(itemStack);
lime igloo
#

sound fancy, but is primitive (not a java primitive, but "primitive" as in "basic")

silent token
#

I looked at an article a bit ago but I cant recall much of it

#

Do you have smth good for vectors and what this quaternion is..?

lime igloo
#

quaternions are essentially 4D vectors (a vector with x, y, z, but also an extra variable w), usually used for rotations in 3d space

silent token
#

I figured out the problem... its because blocks and entities dont have the same origin point so it was getting fucked up